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:
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/thread.cc16
2 files changed, 21 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index fe313fb2f..1521fcfbb 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,13 @@
+2012-02-08 Corinna Vinschen <corinna@vinschen.de>
+
+ * thread.cc (__pthread_cond_wait_init): New static function replacing
+ __pthread_cond_dowait. Only check and potentially initialize cond and
+ mutex, drop call to (*cond)->wait.
+ (pthread_cond_timedwait): Replace call to __pthread_cond_dowait with
+ separate calls to __pthread_cond_wait_init and (*cond)->wait to be
+ able to initialize cond before accessing its clock_id member.
+ (pthread_cond_wait): Ditto (more or less).
+
2012-02-08 Christian Franke <franke@computer.org>
* include/sys/wait.h: Remove C++ inline functions for `union wait'.
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