[sane-devel] Neither get_select_fd() nor non-blocking

m. allan noah anoah at pfeiffer.edu
Wed Nov 1 18:51:02 CET 2006


On Tue, 31 Oct 2006 astrand at cendio.se wrote:

> On Mon, 30 Oct 2006, m. allan noah wrote:

...snip...

>>> Personally, I think the select loop model is superior, but since not all
>>> backends supports get_select_fd, an otherwise select based application
>>> might be forced to start to fork/thread. Not pretty.
>>>
>>
>> in general, the backend is going to have to fork/thread to give you your
>> select_fd. i feel that the management of such OS-specific libs, creation of
>> children, dealing with signals, etc. is in the frontend.
>
> You have a point. OTOH, sanei does provide this infrastructure.

unfortunately, it does not provide it all that well. there were some 
discussions here lately about certain backends 'hijacking' the frontend's 
signals. i cant remember the specifics, off hand. but it would be good for 
the frontend developer who develops using a non-signaling backend, if all 
the backends did not use signals. then he does not get bitten by this 
problem when one of his users uses another backend that does use signals.

...snip...

>> the better solution, imho, is the one taken by e.g. XSANE. if your frontend
>> cares about non-blocking mode because its a gui or whatever, then let it deal
>> with the issue. this is pretty much standard fare for other libs for dns
>> resolves, http/ftp transfers, etc. existing SANE-1 backends can drop the code
>> which provides these options, and the ABI/API does not change. SANE2 can
>> remove the function calls, or leave them such that old frontends can be easily
>> ported.
>
> For DNS resolves you have ADNS. Many HTTP libs also provides non-blocking
> support.
>
> But, you have a point, I agree. libusb doesn't currenly provide an
> asynchronous interface either.
>

yes, there are plenty of counter examples (c-ares), and some even do both 
(libcurl). but in general, these tend to be projects that support a few 
protocols in a single library, with a single point of entry into the ABI.

Sane is much more fragmented. Anything that brings consistency to sane is 
better for front-end devels. The easiest way to get there is to remove 
code, not add it :)

allan

-- 
"so don't tell us it can't be done, putting down what you don't know.
money isn't our god, integrity will free our souls" - Max Cavalera



More information about the sane-devel mailing list