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

Mattias Ellert mattias.ellert@tsl.uu.se
Mon, 23 Feb 2004 23:30:14 +0100


Stephen Magladry wrote:
> I issued the
> 
> export SANE_DEBUG_SANEI_THREAD=255
> only and here are the results.
> 
> [blah:~] blah% scanimage >test.pnm
> [sanei_debug] Setting debug level of sanei_thread to 255.
> [sanei_debug] Setting debug level of sanei_thread to 255.
> [sanei_debug] Setting debug level of sanei_thread to 255.
> [sanei_debug] Setting debug level of sanei_thread to 255.
> [sanei_debug] Setting debug level of sanei_thread to 255.
> [sanei_debug] Setting debug level of sanei_thread to 255.
> [sanei_thread] thread started, calling func() now...
> [sanei_thread] pthread_create() created thread 25179136
> [sanei_thread] func() done - status = 0
> 

The cancelling of the reader thread fails.

Since pthread_cancel is broken on MacOS X there is a workaround 
implemented in sanei_thread. This workaround essentially replaces the 
sanei_cancel call with a SIGUSR2 signal. This means that backends SHOULD 
NEVER disable the SIGUSR2 signal on MacOS X if they want to be cancelled.

For the Plustek backend the following code:

	sigfillset ( &ignore_set );
	sigdelset  ( &ignore_set, SIGTERM );
	sigprocmask( SIG_SETMASK, &ignore_set, 0 );

should be changed to:

	sigfillset ( &ignore_set );
	sigdelset  ( &ignore_set, SIGTERM );
#if defined (__APPLE__) && defined (__MACH__)
	sigdelset  ( &ignore_set, SIGUSR2 );
#endif
	sigprocmask( SIG_SETMASK, &ignore_set, 0 );

This probably affects other backends as well.

	Mattias
-- 
________________________________________________________________________

mattias.ellert@tsl.uu.se                           tel: +46 18 471 32 58
http://www.tsl.uu.se/~ellert/                      fax: +46 18 471 35 13
________________________________________________________________________