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

24 lines
445 B
C
Raw Normal View History

1998-08-20 22:21:35 +00:00
#include <isc/condition.h>
#include <errno.h>
boolean_t
os_condition_waituntil(os_condition_t *c, os_mutex_t *m, os_time_t *t,
1998-08-20 22:21:35 +00:00
boolean_t *timeout)
{
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-08-20 22:21:35 +00:00
*timeout = FALSE;
return (TRUE);
1998-10-16 22:21:21 +00:00
} else if (result == ETIMEDOUT) {
1998-08-20 22:21:35 +00:00
*timeout = TRUE;
return (TRUE);
}
return (FALSE);
}