[sane-devel] strange thread code?

m. allan noah anoah@pfeiffer.edu
Wed, 31 Dec 2003 12:10:12 -0500 (EST)

i am converting the fujitsu backend to use sanei_thread instead of fork.
in reading the threading code, i found something that i dont understand,
and was hoping someone who knows a bit more could explain it to me:
in the function sanei_thread_waitpid(), the #ifdef PTHREAD section always
returns pid (around line 354). but farther down, in the #else section, the 
return val from the waitpid() call is returned (which is the pid on 
success, but 0 or -1 otherwise)

so if you are calling sanei_thread_waitpid() and there is an error, you 
might, or might not, get a negative return value?

am i not reading this code correctly?


"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