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

Henning Meier-Geinitz henning@meier-geinitz.de
Thu, 6 Feb 2003 15:56:23 +0100


Hi,

On Thu, Feb 06, 2003 at 01:30:18AM +0100, abel deuring wrote:
> <flame>
> Did they also bother to explain, why no device files are available which 
> should not have this problem (well, hoping that device file descriptors 
> would survive a fork() on Macos)?
> </flame>

Maybe nobody thought that someone could fork a program instead just
use threads. Threads are modern, nobody uses fork anymore! :-)

I thought part of the Unix philosophy was "everything is a file"?
</rant>

> >Maybe the libusb one day provides a workaround.

If there is no way to get access priviledge from iokit, I don't think
libusb can do anything.

If there is a way, we can do it also in sanei_usb.

There is a similar issue with parport access. Access permissions have
to be regained after a fork. 

> Well, you could try to reverse to roles of parent and child after the 
> fork: the parent could control the scanner, while the child talks with 
> the frontend... Naaa, I should go to bed...

Won't work: when you kill the process after the scan you kill the
frontend you just talked to :-)

There are other ways like close the device and open it again in reader
process or do all the device access in reader process but's that's way
too ugly.

Bye,
  Henning