[sane-devel] Compiling sane-backends CVS 2003/10/22 on OS/2

Gerhard Jaeger gerhard@gjaeger.de
Wed, 29 Oct 2003 17:15:52 +0100


On Wednesday 29 October 2003 11:51, Henning Meier-Geinitz wrote:
> The mustek backend has now support for sanei_thread.=20

good work ;-)

> At least on Linux, it does not work perfectly (cancelling leads to segf=
> sometimes).

As I stated in my former mails, when using pthreads and the canceling
mechanism, one should in general try and let the thread die gracefully.
Which leads to some command exchange mechanism i.e.
The "cancel"-command sets a variable, that will be checked by the=20
reader thread. If detected active, the reader thread stops its acitivity
and exists. Doing this the hard-way via pthread_cancel it might be, that
you run into trouble.
One thing you can test is:
comment out the line with pthread_setcanceltype (should be 201), recompil=
and check if the segfault behaviour is better...