This is the mail archive of the
pthreads-win32@sourceware.cygnus.com
mailing list for the pthreas-win32 project.
Re: Buggy conditions
- To: pthreads-win32@sourceware.cygnus.com
- Subject: Re: Buggy conditions
- From: Todd Owen <towen@nw.com.au>
- Date: Fri, 25 Jun 1999 20:57:51 +0800
At 06:53 PM 6/23/99 +0200, you wrote:
>One question more: What happens, if thread waits on semaphore object, wakes up
>after timeout and then another (broadcasting) thread posts the semaphore? Probably
>another thread will spuriously wake up next time, nothing more. Can someone tell
>his/her opinion to this?
As I understand it, that's the expected behaviour for a semaphore - if the semaphore value is greater than 0, wait()s will complete immediately. So unlike condition variables, semaphores can "count", which sometimes makes them useful (such as in the old producer-consumer problem).
Todd.
....................please cut here....................
Todd Owen <towen@nw.com.au>
=== Netway Technologies ===
http://www.nw.com.au