yes- it would be nice if SANE_Pid was an opaque type, perhaps just an array index or pointer to a struct. Right now the ranges of valid values are not the same pthread vs fork.
allan On Tue, May 5, 2009 at 4:50 PM, Michael Cronenworth <mike at cchtml.com> wrote: > Hi, > > In sanei/sanei_thread.c there's this little tid-bit of code: > > DBG( 2, "pthread_create() created thread %ld\n", (SANE_Pid)thread ); > > "thread" is of type pthread_t, which is an extremely opaque type. You won't > get a reliable answer by casting it as long and printing it for debugging > purposes. I'd suggest removing or revising this code. > > Also, type defining SANE_Pid as type long and setting pthread_t type > variables to this type will result in undefined behaviour. > > pthread != pid > as > pthread_create() != fork() > > Looks like all of sanei_thread.c needs work. I'm working on a patch. > > Michael > > -- > sane-devel mailing list: sane-devel at lists.alioth.debian.org > http://lists.alioth.debian.org/mailman/listinfo/sane-devel > Unsubscribe: Send mail with subject "unsubscribe your_password" > ? ? ? ? ? ?to sane-devel-request at lists.alioth.debian.org > -- "The truth is an offense, but not a sin"
