Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Mar 2005 21:53:29 +0100
From:      Peter Schuller <peter.schuller@infidyne.com>
To:        Jonathon McKitrick <jcm@FreeBSD-uk.eu.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Blocking on multiple threads with timeout
Message-ID:  <20050301205328.GA22912@scode-whitestar.mine.nu>
In-Reply-To: <20050227190842.GC34795@dogma.freebsd-uk.eu.org>
References:  <20050227190842.GC34795@dogma.freebsd-uk.eu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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@infidyne.com>'
Key retrieval: Send an E-Mail to getpgpkey@scode.org
E-Mail: peter.schuller@infidyne.com Web: http://www.scode.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050301205328.GA22912>