Cygwin: pthread_cond_timedwait: make sure to wait until abstime finishes
This commit is contained in:
parent
5eaa64f9d8
commit
0b868df147
|
@ -2945,25 +2945,33 @@ extern "C" int
|
||||||
pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
|
pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||||
const struct timespec *abstime)
|
const struct timespec *abstime)
|
||||||
{
|
{
|
||||||
|
int err = 0;
|
||||||
LARGE_INTEGER timeout;
|
LARGE_INTEGER timeout;
|
||||||
|
|
||||||
pthread_testcancel ();
|
pthread_testcancel ();
|
||||||
|
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
int err = __pthread_cond_wait_init (cond, mutex);
|
err = __pthread_cond_wait_init (cond, mutex);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
__leave;
|
||||||
|
|
||||||
err = pthread_convert_abstime ((*cond)->clock_id, abstime, &timeout);
|
do
|
||||||
if (err)
|
{
|
||||||
return err;
|
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
|
__endtry
|
||||||
return EINVAL;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int
|
extern "C" int
|
||||||
|
|
Loading…
Reference in New Issue