[sane-devel] pthreads for MacOSX (instead of child process)

Beat Birkhofer beat.birkhofer@ilw.agrl.ethz.ch
Mon, 3 Feb 2003 01:31:03 +0100


Hi

There's a problem with backends (plustek in my case) that use fork() 
on MacOSX. Due to the IOKit it's impossible that two processes access 
the USB at the same time.

I solved the problem by replacing the child process by a pthread.

The problem: There are about 15 #ifdefs in plustek.c (quite ugly) and 
I had to modify the Plustek_Scanner struct. The solution for OS/2 
(sanei_thread) didn't seem very useful for my problem because I had 
to apply changes to several functions.

Im not an experienced (cross platform) developer. Any ideas for an 
elegant solution to implement the pthreads stuff for MacOSX/Darwin?

I uploaded the files with my changes (it's a quickhack!):

http://www.vseth.ethz.ch/~birkhofer/plustek.c
http://www.vseth.ethz.ch/~birkhofer/plustek.h

Regards

Beat H.