1998-08-20 22:21:35 +00:00
|
|
|
|
|
|
|
#include <isc/condition.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
1998-10-21 01:13:50 +00:00
|
|
|
isc_boolean_t
|
1998-10-16 22:09:09 +00:00
|
|
|
os_condition_waituntil(os_condition_t *c, os_mutex_t *m, os_time_t *t,
|
1998-10-21 01:13:50 +00:00
|
|
|
isc_boolean_t *timeout)
|
1998-08-20 22:21:35 +00:00
|
|
|
{
|
1998-10-16 22:21:21 +00:00
|
|
|
int result;
|
1998-10-16 22:09:09 +00:00
|
|
|
struct timespec ts;
|
1998-08-20 22:21:35 +00:00
|
|
|
|
1998-10-16 22:09:09 +00:00
|
|
|
ts.tv_sec = t->seconds;
|
|
|
|
ts.tv_nsec = t->nanoseconds;
|
1998-10-16 22:21:21 +00:00
|
|
|
result = pthread_cond_timedwait(c, m, &ts);
|
|
|
|
if (result == 0) {
|
1998-10-21 01:13:50 +00:00
|
|
|
*timeout = ISC_FALSE;
|
|
|
|
return (ISC_TRUE);
|
1998-10-16 22:21:21 +00:00
|
|
|
} else if (result == ETIMEDOUT) {
|
1998-10-21 01:13:50 +00:00
|
|
|
*timeout = ISC_TRUE;
|
|
|
|
return (ISC_TRUE);
|
1998-08-20 22:21:35 +00:00
|
|
|
}
|
1998-10-21 01:13:50 +00:00
|
|
|
return (ISC_FALSE);
|
1998-08-20 22:21:35 +00:00
|
|
|
}
|