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:
authorCorinna Vinschen <corinna@vinschen.de>2018-11-29 01:49:59 +0300
committerCorinna Vinschen <corinna@vinschen.de>2018-11-29 12:01:57 +0300
commit0b868df147d613b6f277161eff4ac2834aa24ee7 (patch)
treef766e0f93162bad3e7d637431c470e4b024d5fd6
parent5eaa64f9d86cae422016c3b08476b1cea556628e (diff)
Cygwin: pthread_cond_timedwait: make sure to wait until abstime finishes
-rw-r--r--winsup/cygwin/thread.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 0bddaf345..c47a597be 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -2945,25 +2945,33 @@ extern "C" int
pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
const struct timespec *abstime)
{
+ int err = 0;
LARGE_INTEGER timeout;
pthread_testcancel ();
__try
{
- int err = __pthread_cond_wait_init (cond, mutex);
+ err = __pthread_cond_wait_init (cond, mutex);
if (err)
- return err;
+ __leave;
- err = pthread_convert_abstime ((*cond)->clock_id, abstime, &timeout);
- if (err)
- return err;
+ do
+ {
+ err = pthread_convert_abstime ((*cond)->clock_id, abstime, &timeout);
+ if (err)
+ __leave;
- return (*cond)->wait (*mutex, &timeout);
+ err = (*cond)->wait (*mutex, &timeout);
+ }
+ while (err == ETIMEDOUT);
+ }
+ __except (NO_ERROR)
+ {
+ return EINVAL;
}
- __except (NO_ERROR) {}
__endtry
- return EINVAL;
+ return err;
}
extern "C" int