2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-24 19:18:50 +00:00
bind/lib/isc/pthreads/condition.c

24 lines
473 B
C
Raw Normal View History

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
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;
struct timespec ts;
1998-08-20 22:21:35 +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
}