[sane-devel] RE: (Big?) Problem with fork() in OSX

abel deuring a.deuring at satzbau-gmbh.de
Wed Dec 18 15:42:46 GMT 2002


Henning Meier-Geinitz wrote:
> 
> Hi,
> 
> On Wed, Dec 18, 2002 at 02:39:47PM -0000, Phil Barrett wrote:
> > The problem is that after you call (*taskinferface->ObtainExclusiveAccess)()
> > a fork()ed thread is then denied access because the first thread has
> > exclusive access.
> 
> I thought fork creates new processes not threads?
> 
> I don't see how to workaround such problems in SANE.
> 
> I don't even see how to workaround it in libusb if there is no way to
> regain acces in the child process.
> 
> Isn't there any way to make sure that childrens of the current process
> can access the already opened devices?
> 
> Otherwise I guess Mac OS X and SANE is a no-go at least for some
> backends.

<rant>well, the Apple folks sometimes have crazy ideas. Think about
these unusable round mice sold with older IMacs.</rant>

Theoretically, it could be possible to replace the fork call with
somethink like "sane_fork". For sane (i.e., non-darwin) operating
systems, this function would just call fork; for Macos, sane_fork could
additionally duplicate/reopen all necessary, hmmm, "non-filedescriptors"
which are required by the child process to access the scanner. The
necessary information could be collected by sanei_scsi_open or
sanei_usb_open.

Abel



More information about the sane-devel mailing list