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

Mattias Ellert mattias.ellert at tsl.uu.se
Thu Feb 26 11:37:01 GMT 2004


Gerhard Jaeger wrote:
> Hi Mattias,
>  
> 
> Of course you are right. I'm really not sure how to proceed. I think I need
> some time to think about that stuff...
> 
> Ciao,
>   Gerhard
> 

Something like this, maybe....

	Mattias



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
}





More information about the sane-devel mailing list