aboutsummaryrefslogtreecommitdiff
path: root/src/pth.c
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2020-08-24 09:37:43 +0930
committerDavid Timber <mieabby@gmail.com>2020-08-24 10:05:29 +0930
commitacf0b7a45171555eba2c10a6ef84f915c62f6791 (patch)
tree7253e8d86a199948530671c8bf59ecbb2c6e08f8 /src/pth.c
parent076671e7aa28451de087088c2e47f9e6064ae434 (diff)
* 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
Diffstat (limited to 'src/pth.c')
-rw-r--r--src/pth.c18
1 files changed, 6 insertions, 12 deletions
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;