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>
|
1998-12-04 20:00:26 +00:00
|
|
|
#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;
|
1998-10-16 22:09:09 +00:00
|
|
|
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
|
|
|
}
|