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

abel deuring a.deuring@satzbau-gmbh.de
Fri, 14 Feb 2003 18:59:45 +0100


Hubert Figuiere wrote:
> 
> On samedi, fév 8, 2003, at 19:41 Europe/Paris, abel deuring wrote:
> 
> [ snipped useless-and-out-of-topic rant ]
> 
> > I also had a short look into Apple's mailing list archives. The
> > answers to a question by Beat regarding device access from forked
> > processes seem to indicate there is really not hope. The main reason
> > seems to be "too complicated to implement for Mach". (BTW, the
> > archives of older mailings are the worst organized archives I have
> > seen since a long time. So much for the shiny surface of Apple
> > stuff...)
> 
> [...]
> > Somebody proposed to the apple mailing list to start a sort of a
> > daemon which accesses the device. Since sockets (pipes too?) seem to
> > survive a fork on macos, this could indeed be a way to avoid the
> > current fork hassles. Other ways would be to provide a non-forking
> > version of the backend (like the Sharp and NEC backends do), or to
> > make the backends thread-safe (should not be that much work, since the
> > tasks of the two processes/threads are different enough), and to
> > expand the sanei_thread library.
> 
> I'm not really an IOKit expert, but perhaps should one write a generic
> device driver for USB that just create proper device entries.
> 
> I suggest emulating *BSD USB behaviour. That way, we then would need to
> change libusb to use *BSD code and we would have a better
> compatibility. IOKit use as its advantage, like allowing USB access in
> userland, but the mach_port problem is not a simple issue.
> 
> Just a thought, I'll dig further to see what can be done (not sure I'll
> have the time to actually code anything)

Hubert,

don't want to discourage you (after all, this approach would save the
Sane developer some work ;), but Beat has already asked about such
things on Apple's Unix-porting mailing list, and the answers were not
very promising:

http://lists.apple.com/mhonarc/unix-porting/msg01809.html
http://lists.apple.com/mhonarc/unix-porting/msg01814.html

(fortunately on the better oganized part of the mailing lsit archive, at
least currently) Please note the password hints in the authentication
dialog.

Abel