This is the mail archive of the
mailing list for the pthreas-win32 project.
- To: Lorin Hochstein <firstname.lastname@example.org>
- Subject: Re: pthread_cond_broadcast()
- From: Peter Slacik <Peter.Slacik@tatramed.sk>
- Date: Tue, 29 Jun 1999 13:33:56 +0200
- Cc: pthreads mailing list <email@example.com>
- Organization: TatraMed s.r.o.
- References: <3778FFC0.FFFDD5DD@xiphos.ca>
Lorin Hochstein wrote:
> I tried to test this by writing a smaller program which just does this
> (attached to this e-mail). However, this smaller program seems to have
> even bigger problems, the threads never respond to the broadcast, and I
> have no clue why (it works just fine in Linux)! Could anybody offer any
First, you are locking mutex1 in one thread - main(), and unlocks it in thread
which did not lock it - thread1(), thread2().
Second, you uses mutex1 for pthread_cond_wait() call (without locking it first).
Third, it is advisable to call pthread_cond_signal() / pthread_cond_broadcast()
with the associated mutex locked, and pthreads-win32 requests this.
And - each time check pthread_*() return values, even in the test code!
Hope this helps you