Commit 2acf5526 authored by Bob Halley's avatar Bob Halley
Browse files

update

parent d740c17c
#include <isc/condition.h>
#include <errno.h>
boolean_t
os_condition_waituntil(os_condition_t *c, os_mutex_t *m, struct timespec *ts,
boolean_t *timeout)
{
int result;
result = pthread_cond_timedwait(c, m, ts);
if (result == 0) {
*timeout = FALSE;
return (TRUE);
} else if (result == ETIMEDOUT) {
*timeout = TRUE;
return (TRUE);
}
return (FALSE);
}
......@@ -3,9 +3,9 @@
#define CONDITION_H 1
#include <pthread.h>
#include <errno.h>
#include <isc/boolean.h>
#include <isc/mutex.h>
#include <isc/assertions.h>
typedef pthread_cond_t os_condition_t;
......@@ -13,12 +13,13 @@ typedef pthread_cond_t os_condition_t;
#define os_condition_init(cp) (pthread_cond_init((cp), NULL) == 0)
#define os_condition_wait(cp, mp) (pthread_cond_wait((cp), (mp)) == 0)
#define os_condition_waituntil(cp, mp, tsp, top) \
(pthread_cond_timedwait((cp), (mp), (tsp)) == 0 \
? TRUE \
: ((*(top) = (errno == ETIMEDOUT)), FALSE))
#define os_condition_signal(cp) (pthread_cond_signal((cp)) == 0)
#define os_condition_broadcast(cp) (pthread_cond_broadcast((cp)) == 0)
#define os_condition_destroy(cp) (pthread_cond_destroy((cp)) == 0)
boolean_t os_condition_waituntil(os_condition_t *,
os_mutex_t *,
struct timespec *,
boolean_t *);
#endif /* CONDITION_H */
......@@ -766,6 +766,12 @@ task_manager_destroy(task_manager_t *managerp) {
/*
* Wait for all the worker threads to exit.
*
* XXX This will become a timed wait. If all the workers haven't
* died after we've waited the specified interval, we will
* kill the worker threads. Should we join with the worker
* threads after killing them or just leave them detached and
* hope they go away?
*/
while (manager->workers > 0)
WAIT(&manager->no_workers, &manager->lock);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment