[sane-devel] Thread code review and testers

Michael Cronenworth mike at cchtml.com
Mon Nov 7 15:45:03 UTC 2011


Chris Bagwell wrote:
> I'm looking for a reviewer of attached patch and I'm also hoping
> someone has a scanner who's driver uses threads can test this patch to
> verify no regressions occurred (be sure and use --enable-pthread on
> configure).
>
> Current code assumes/requires that SANE_Pid is represented as an
> integer on all platforms because we do "pid == -1" checks everywhere.
>
> Pthreads says that it can not be assumed pthread_t is an integer and
> on windows platform it in fact is not an integer.  Attached is my
> solution to abstract out checks for valid PID's so that it will work
> with windows and any other pthread implementation that is similar.
>
> For each backend that gets ported to mingw and uses threads, it will
> need to switch to use sanei_thread_is_invalid(pid) instead of (pid ==
> -1).  That was not done as a part of this test patch.

Good job! I cringed at the code when I saw it mangling pthread_t, but 
now I can cringe less. I unofficially say that your patch looks good.

I'll try the latest git checkout plus this patch and see if it works any 
better for me.



More information about the sane-devel mailing list