From acf0b7a45171555eba2c10a6ef84f915c62f6791 Mon Sep 17 00:00:00 2001 From: David Timber Date: Mon, 24 Aug 2020 09:37:43 +0930 Subject: * htbt checkpoint * Change PRNE_BUILD_ENTROPY to uint8_t array * endian.h problem * Remove "-I." CFLAG added by Automake () * Moved endian conversion macros to endian.h * Moved DNS server config from config.h to resolv.h to reduce compile time * Refactor resolv_ensure_act_dns_fd() to reduce binary size --- src/pth.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/pth.c') diff --git a/src/pth.c b/src/pth.c index b727436..2f8bbe4 100644 --- a/src/pth.c +++ b/src/pth.c @@ -14,7 +14,7 @@ void prne_init_worker (prne_worker_t *w) { void prne_free_worker (prne_worker_t *w) { if (w->ctx != NULL) { - prne_assert(w->free_ctx != NULL); + prne_assert(w->free_ctx != NULL); w->free_ctx(w->ctx); w->ctx = NULL; } @@ -46,22 +46,16 @@ bool prne_pth_cond_timedwait (prne_pth_cv_t *cv, const struct timespec *timeout, if (timeout != NULL) { ev = pth_event(PTH_EVENT_TIME, pth_timeout(timeout->tv_sec, timeout->tv_nsec / 1000)); - if (ev == NULL) { - return -1; - } + prne_assert(ev != NULL); } else { ev = NULL; } - if (pth_mutex_acquire(cv->lock, FALSE, NULL)) { - ret = pth_cond_await(cv->cond, cv->lock, ev); - prne_assert(pth_mutex_release(cv->lock)); - } - else { - ret = false; - } - + prne_assert(pth_mutex_acquire(cv->lock, FALSE, NULL)); + ret = pth_cond_await(cv->cond, cv->lock, ev) != 0; + prne_assert(pth_mutex_release(cv->lock)); + if (ev != NULL && pth_event_occurred(ev)) { ret = true; reached = true; -- cgit