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

28 lines
550 B
C
Raw Normal View History

1998-08-20 22:21:35 +00:00
1998-12-12 19:25:20 +00:00
#include <config.h>
1998-08-20 22:21:35 +00:00
#include <errno.h>
1998-10-22 01:33:20 +00:00
#include <string.h>
#include <isc/condition.h>
#include <isc/error.h>
1998-08-20 22:21:35 +00:00
1998-10-22 01:33:20 +00:00
isc_result_t
isc_condition_waituntil(isc_condition_t *c, isc_mutex_t *m, isc_time_t t)
1998-08-20 22:21:35 +00:00
{
1998-10-22 01:33:20 +00:00
int presult;
struct timespec ts;
1998-08-20 22:21:35 +00:00
1998-10-23 23:01:12 +00:00
isc_time_totimespec(t, &ts);
1998-10-22 01:33:20 +00:00
presult = pthread_cond_timedwait(c, m, &ts);
if (presult == 0)
return (ISC_R_SUCCESS);
if (presult == ETIMEDOUT)
return (ISC_R_TIMEDOUT);
UNEXPECTED_ERROR(__FILE__, __LINE__,
"pthread_cond_timedwait() returned %s",
strerror(presult));
return (ISC_R_UNEXPECTED);
1998-08-20 22:21:35 +00:00
}