[Fwd: Re: [sane-devel] Problem with Plustek and Canonscan 1220u on Mac 10.3.2]

Gerhard Jaeger gerhard@gjaeger.de
Mon, 1 Mar 2004 21:23:55 +0100


On Thursday 26 February 2004 12:37, Mattias Ellert wrote:
[SNIPSNAP]
> > Of course you are right. I'm really not sure how to proceed. I think I
> > need some time to think about that stuff...
>
> Something like this, maybe....
>
> 	Mattias

I also thought of introducing some additional functions for that, but here we
will also have the problem, that the settings from the backends will be
ignored. No matter what we decide to use, the function or the backend
needs to take care about the previous signal-settings.
Probably we only need one function after the reader-process has setup its
signal stuff, to reenable the SIGUSR2 signal for the work-around...

Ciao,
  Gerhard

>
>
>
> void sanei_thread_allow_cancel () {
>
> #ifdef USE_PTHREAD
> #if defined (__APPLE__) && defined (__MACH__)
> 	sigset_t sigset;
> 	sigemptyset ( &sigset );
> 	sigaddset   ( &sigset, SIGUSR2 );
> 	sigprocmask ( SIG_UNBLOCK, &sigset, 0 );
> #else
> 	int old;
> 	pthread_setcancelstate ( PTHREAD_CANCEL_ENABLE, &old );
> #endif
> #else
> 	sigset_t sigset;
> 	sigemptyset ( &sigset );
> 	sigaddset   ( &sigset, SIGTERM );
> 	sigprocmask ( SIG_UNBLOCK, &sigset, 0 );
> #endif
> }
>
>
> void sanei_thread_disallow_cancel () {
>
> #ifdef USE_PTHREAD
> #if defined (__APPLE__) && defined (__MACH__)
> 	sigset_t sigset;
> 	sigemptyset ( &sigset );
> 	sigaddset   ( &sigset, SIGUSR2 );
> 	sigprocmask ( SIG_BLOCK, &sigset, 0 );
> #else
> 	int old;
> 	pthread_setcancelstate ( PTHREAD_CANCEL_DISABLE, &old );
> #endif
> #else
> 	sigset_t sigset;
> 	sigemptyset ( &sigset );
> 	sigaddset   ( &sigset, SIGTERM );
> 	sigprocmask ( SIG_BLOCK, &sigset, 0 );
> #endif
> }