Re: pthread_cond_signal() has no effect
"Saurabh Desai" <[email protected]>
| Newsgroups | gmane.linux.ngpt.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello Uwe,
Thanks for reporting and providing a testcase for this problem.
I have fixed this and the fix will be available in NGPT 2.0.2 release.
- - - - -
Saurabh Desai
POSIX Threading for Linux
IBM Linux Technology Center
"Dr. Uwe Girlich" <[email protected]>@www-124.southbury.usf.ibm.com
on 08/30/2002 08:31:00 AM
Sent by: [email protected]
To: pthreads-devel <[email protected]>
cc:
Subject: [pthreads-devel] pthread_cond_signal() has no effect
Hello!
There is an error in the NGPT pthread_cond_signal() handling. If there are
several (n) waiters on a conditional variable and the wakeup thread
calls fast n times pthread_cond_signal(), only one of the waiter threads
will
end its pthread_cond_wait().
2 things to note:
* Process shared objects use fuxex functionality, which works correctly.
* If there is a delay between the pthread_cond_signal() calls, so that the
first thread can end its pthread_cond_wait() until the wakeup thread calls
pthread_cond_signal() again, it works too.
So I come to the conclusion: process private conditional variables have a
problem, when the scheduler does not schedule the just woken up thread.
The attached mini test program demonstrates the wrong behaviour.
Without any arguments, the second thread does not wake up.
With -s1, it uses shared objects and it works.
With -w1, it uses sleep(1) between pthread_cond_signal() calls and it works
too.
Bye, Uwe
--
Dr. Uwe Girlich email: [email protected]
Philosys Software GmbH www: www.philosys.de
Edisonstrasse 6 phone: +49 89 321407-44
D-85716 Unterschleissheim fax: +49 89 321407-12