Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-06-07 23:55:06 +0400
committerChristopher Faylor <me@cgf.cx>2001-06-07 23:55:06 +0400
commit5691881058b52c0fdec0caea781752203f9b2214 (patch)
tree14cbd562466c7c59f0574096398502f24f9ce8b7 /winsup/cygwin/thread.cc
parent5a2f66ab43537960eb32d109699cf43adffd2fce (diff)
* thread.cc (pthread_cond::Broadcast): Don't print error messages on invalid
mutexs - user programs are allowed to call pthread_cond_broadcast like that. (__pthread_cond_timedwait): Initialise themutex properly. (__pthread_cond_wait): Initialise themutex properly.
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index ad2ad00c4..894038855 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -424,7 +424,10 @@ pthread_cond::BroadCast ()
{
if (pthread_mutex_unlock (&cond_access))
system_printf ("Failed to unlock condition variable access mutex, this %0p\n", this);
- system_printf ("Broadcast called with invalid mutex\n");
+ /* This isn't and API error - users are allowed to call this when no threads
+ are waiting
+ system_printf ("Broadcast called with invalid mutex\n");
+ */
return;
}
while (count--)
@@ -1639,6 +1642,8 @@ __pthread_cond_timedwait (pthread_cond_t * cond, pthread_mutex_t * mutex,
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE))
// a pshared mutex
themutex = __pthread_mutex_getpshared (mutex);
+ else
+ themutex = mutex;
if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
return EINVAL;
@@ -1685,6 +1690,8 @@ __pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex)
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE))
// a pshared mutex
themutex = __pthread_mutex_getpshared (mutex);
+ else
+ themutex = mutex;
if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
return EINVAL;
if (!verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC))