diff options
Diffstat (limited to 'src/irmd')
-rw-r--r-- | src/irmd/reg/flow.c | 11 | ||||
-rw-r--r-- | src/irmd/reg/name.c | 18 | ||||
-rw-r--r-- | src/irmd/reg/proc.c | 6 | ||||
-rw-r--r-- | src/irmd/reg/proc.h | 2 |
4 files changed, 11 insertions, 26 deletions
diff --git a/src/irmd/reg/flow.c b/src/irmd/reg/flow.c index 30b9c504..898f2604 100644 --- a/src/irmd/reg/flow.c +++ b/src/irmd/reg/flow.c @@ -197,15 +197,8 @@ int reg_flow_wait_state(struct reg_flow * f, while (!(f->state == state || f->state == FLOW_DESTROY || f->state == FLOW_DEALLOC_PENDING) && - ret != -ETIMEDOUT) { - if (dl != NULL) - ret = -pthread_cond_timedwait(&f->cond, - &f->mtx, - dl); - else - ret = -pthread_cond_wait(&f->cond, - &f->mtx); - } + ret != -ETIMEDOUT) + ret = -__timedwait(&f->cond, &f->mtx, dl); if (f->state == FLOW_DESTROY || f->state == FLOW_DEALLOC_PENDING || diff --git a/src/irmd/reg/name.c b/src/irmd/reg/name.c index 7e13e888..4d26c762 100644 --- a/src/irmd/reg/name.c +++ b/src/irmd/reg/name.c @@ -415,15 +415,17 @@ int reg_name_leave_state(struct reg_name * name, enum name_state state, struct timespec * timeout) { - struct timespec abstime; - int ret = 0; + struct timespec ts; + struct timespec * abstime = NULL; + int ret; assert(name); assert(state != NAME_DESTROY); if (timeout != NULL) { - clock_gettime(PTHREAD_COND_CLOCK, &abstime); - ts_add(&abstime, timeout, &abstime); + clock_gettime(PTHREAD_COND_CLOCK, &ts); + ts_add(&ts, timeout, &ts); + abstime = &ts; } pthread_mutex_lock(&name->mtx); @@ -431,13 +433,7 @@ int reg_name_leave_state(struct reg_name * name, pthread_cleanup_push(__cleanup_mutex_unlock, &name->mtx); while (name->state == state && ret != -ETIMEDOUT) - if (timeout) - ret = -pthread_cond_timedwait(&name->cond, - &name->mtx, - &abstime); - else - ret = -pthread_cond_wait(&name->cond, - &name->mtx); + ret = -__timedwait(&name->cond,&name->mtx, abstime); if (name->state == NAME_DESTROY) { ret = -1; diff --git a/src/irmd/reg/proc.c b/src/irmd/reg/proc.c index 1aae789d..8a016afe 100644 --- a/src/irmd/reg/proc.c +++ b/src/irmd/reg/proc.c @@ -211,11 +211,7 @@ int reg_proc_sleep(struct reg_proc * proc, pthread_cleanup_push(cancel_reg_proc, proc); while (proc->state == PROC_SLEEP && ret != -ETIMEDOUT) - if (dl != NULL) - ret = -pthread_cond_timedwait(&proc->cond, - &proc->lock, dl); - else - ret = -pthread_cond_wait(&proc->cond, &proc->lock); + ret = -__timedwait(&proc->cond, &proc->lock, dl); pthread_cleanup_pop(false); diff --git a/src/irmd/reg/proc.h b/src/irmd/reg/proc.h index fb11f34f..4c4ace24 100644 --- a/src/irmd/reg/proc.h +++ b/src/irmd/reg/proc.h @@ -28,7 +28,7 @@ #include "utils.h" #include <unistd.h> -#include <pthread.h> +#include <ouroboros/pthread.h> enum proc_state { PROC_NULL = 0, |