CancelableWait in misc.c should check for negative timeout
Tor Lillqvist
tml@iki.fi
Thu Mar 25 14:28:00 GMT 1999
I think the function CancelableWait should check for timeout being
negative (when casted to an int, that is). This can happen if you call
pthread_cond_timedwait with an abstime that's already gone, because of
some rounding error or slightly incorrect handling of various
timestamp formats. It happens for instance in GLib's testgthread
program. If timeout is negative, it probably should be treated as
zero.
In CancelableWait, before calling WaitForMultipleObjects, insert:
if (((int) timeout) < 0)
timeout = 0;
Cheers,
--tml
More information about the Pthreads-win32
mailing list