summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--condvar.c13
2 files changed, 20 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 0eee706..ddfb3ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,19 @@
+Fri May 28 13:33:05 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * condvar.c (pthread_cond_broadcast): Fix possible memory fault
+ - Mark E. Armstrong <avail@pacbell.net>
+
+Thu May 27 13:08:46 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * condvar.c (pthread_cond_broadcast): Fix logic bug
+ - Peter Slacik <Peter.Slacik@tatramed.sk>;
+ optimise sem_post loop
+ - Bossom, John <John.Bossom@Cognos.COM>.
+
Fri May 14 12:13:18 1999 Ross Johnson <rpj@swan.canberra.edu.au>
- * attr.c (pthread_attr_setdetachstate): Fix logic bug.
+ * attr.c (pthread_attr_setdetachstate): Fix logic bug
+ - Mike Russo <miker@eai.com>.
Wed Apr 7 14:09:52 1999 Ross Johnson <rpj@swan.canberra.edu.au>
diff --git a/condvar.c b/condvar.c
index a77b56a..c1f192c 100644
--- a/condvar.c
+++ b/condvar.c
@@ -827,8 +827,6 @@ pthread_cond_broadcast (pthread_cond_t * cond)
cv = *cond;
- cv->wasBroadcast = TRUE;
-
/*
* No-op if the CV is static and hasn't been initialised yet.
*/
@@ -837,13 +835,14 @@ pthread_cond_broadcast (pthread_cond_t * cond)
return 0;
}
+ cv->wasBroadcast = TRUE;
+
/*
* Wake up all waiters
*/
- for (i = cv->waiters; i > 0 && result == 0; i--)
- {
- result = sem_post (&(cv->sema));
- }
+ result = (ReleaseSemaphore( cv->sema, cond->waiters, NULL )
+ ? 0
+ : EINVAL);
if (cv->waiters > 0 && result == 0)
{
@@ -851,7 +850,7 @@ pthread_cond_broadcast (pthread_cond_t * cond)
* Wait for all the awakened threads to acquire their part of
* the counting semaphore
*/
- if (WaitForSingleObject (cv->waitersDone, INFINITE) !=
+ if (WaitForSingleObject (cv->waitersDone, INFINITE) ==
WAIT_OBJECT_0)
{
result = 0;