This is the mail archive of the pthreads-win32@sourceware.cygnus.com mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Buggy conditions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]