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:
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 901155a0e..5425a9354 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -2746,8 +2746,7 @@ pthread_cond_signal (pthread_cond_t *cond)
}
static int
-__pthread_cond_dowait (pthread_cond_t *cond, pthread_mutex_t *mutex,
- PLARGE_INTEGER waitlength)
+__pthread_cond_wait_init (pthread_cond_t *cond, pthread_mutex_t *mutex)
{
if (!pthread_mutex::is_good_object (mutex))
return EINVAL;
@@ -2759,7 +2758,7 @@ __pthread_cond_dowait (pthread_cond_t *cond, pthread_mutex_t *mutex,
if (!pthread_cond::is_good_object (cond))
return EINVAL;
- return (*cond)->wait (*mutex, waitlength);
+ return 0;
}
extern "C" int
@@ -2775,6 +2774,10 @@ pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
pthread_testcancel ();
+ int err = __pthread_cond_wait_init (cond, mutex);
+ if (err)
+ return err;
+
/* According to SUSv3, the abstime value must be checked for validity. */
if (abstime->tv_sec < 0
|| abstime->tv_nsec < 0
@@ -2803,7 +2806,7 @@ pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
timeout.QuadPart *= -1LL;
break;
}
- return __pthread_cond_dowait (cond, mutex, &timeout);
+ return (*cond)->wait (*mutex, &timeout);
}
extern "C" int
@@ -2811,7 +2814,10 @@ pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
{
pthread_testcancel ();
- return __pthread_cond_dowait (cond, mutex, NULL);
+ int err = __pthread_cond_wait_init (cond, mutex);
+ if (err)
+ return err;
+ return (*cond)->wait (*mutex, NULL);
}
extern "C" int