Blocking on multiple threads with timeout
Peter Schuller
peter.schuller at infidyne.com
Tue Mar 1 20:49:27 GMT 2005
> I have a few threads that might need as long as a minute or more to
> complete and terminate. If they exceed an arbitrary time, they can be
> canceled.
>
> In Win32, there is a 'wait on multiple objects' call. I'm not sure if it
> blocks or spins, but it *does* take a timeout argument.
How about having the threads signal their completion explicitly while also
signalling a condition. You could then have a monitoring thread using
pthread_cond_timedwait() which would enable you to time out without
busy-waiting.
Cleanly killing the thread in question is another matter though...
--
/ Peter Schuller, InfiDyne Technologies HB
PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller at infidyne.com>'
Key retrieval: Send an E-Mail to getpgpkey at scode.org
E-Mail: peter.schuller at infidyne.com Web: http://www.scode.org
More information about the freebsd-questions
mailing list