[sane-devel] sane_cancel and sane_read

Wittawat Yamwong wy-sane-devel at arcor.de
Tue Apr 25 13:07:38 UTC 2006


Hi!

Should/must/may a frontend call sane_read after sane_cancel?

Case I: sane_cancel was called in a signal handler or in other thread. The 
reader thread still keeps calling sane_read until it returns an error or EOF. 
That's clear for me.

Case II: The frontend has read a block of image data from a backend and it is 
writing the data to a file but a IO error occurs. The frontend probably calls 
sane_cancel. What will/must the frontend do next? Will it call sane_read 
until an error or EOF occurs?

This is important to my backend (pixma). It would be much more complex if 
frontends are not required to call sane_read after sane_cancel because I have 
to check whether sane_cancel was called synchronously or asynchronously. If 
it's called synchronously (case II), an outstanding scan operation must be 
completely canceled before sane_cancel returns. If it's call asynchronously 
(case I), the request must be postponed by setting a flag for example. The 
request will be carried out when we return to the reader thread.

Regards
-- 
Wittawat Yamwong
Hannover, Germany



More information about the sane-devel mailing list