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

m. allan noah anoah at pfeiffer.edu
Mon Oct 30 15:05:52 UTC 2006


astrand- sorry if you get this twice...

On Mon, 30 Oct 2006 astrand at cendio.se wrote:

>
> I've realized that backends might not provide neither a file descriptor
> for select() nor non-blocking mode. Why is this allowed? I guess this
> means that applications, such as xsane, must use a separate thread or
> process to read the data? IMHO, this puts a lot of unnecessary burden on
> the application programmer. How common is it with backends with neither a
> select FD nor non-blocking mode? How about adjusting the standard so that
> backends must at least support one of these?
>

my personal opinion only:

there are plenty of front-ends for which non-blocking mode is not required
(think command line, or cgi script, etc). all of my front-ends work this
way. if each backend (there are 68+ of them) has both a blocking and a
non-blocking mode, that is quite a bit of code. it is also significantly
more difficult to debug the backend when it is multi-threaded. given that
many of our backends are rarely touched or are maintained by someone other
than the original author, it makes sense to keep them simple.

besides, its easier for app developer (who likely has multi-threading in 
his app already for other purposes) to decide that he needs it, and deal 
with the threading himself.

the fujitsu backend no longer has threading for this reason.

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