Re: sane-0.62 released

David Mosberger-Tang (davidm@azstarnet.com)
Sun, 27 Jul 1997 08:02:56 -0700

>>>>> On Sun, 27 Jul 1997 09:37:21 +0200 (MET DST), R.E.Wolff@BitWizard.nl (Rogier Wolff) said:

Rogier> nread = read (s->pipe, buf, max_len);
Rogier> DBG(3, "read %ld bytes\n", (long) nread);

Rogier> if (!s->scanning)
Rogier> return do_stop (s);

Note that sane_cancel() can be called asynchronously from a signal
handler. This means that sane_cancel() may be called while waiting
for data in the read() syscall. When this happens, sane_cancel() will
kill the reader-process and set s->scanning to FALSE, but it will not
do any other cleanup (since that wouldn't be safe without additional
"locking"). Once the main-process recognizes that scanning has been
cancelled (!s->scanning is TRUE), it does the remaining clean up by
calling do_stop().

The reason s->scanning() does not get checked _before_ read() is
called is because the frontends will not call sane_read() after
cancelling the scan (well, it wouldn't hurt to check anyways, I
suppose).

--david

--
Source code, list archive, and docs: http://www.azstarnet.com/~axplinux/sane/
To unsubscribe: mail -s unsubscribe sane-devel-request@listserv.azstarnet.com