From 9dce327e10bffddc9dc5058f06407e8ff12389b7 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Tue, 9 Aug 2016 16:06:12 +0200 Subject: lib: Various fixes Fix missing set of api upon flow_alloc. Various locking fixes. --- src/irmd/reg_api.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/irmd/reg_api.c') diff --git a/src/irmd/reg_api.c b/src/irmd/reg_api.c index d50f89e8..648dc1b3 100644 --- a/src/irmd/reg_api.c +++ b/src/irmd/reg_api.c @@ -111,8 +111,11 @@ void reg_api_wake(struct reg_api * i) pthread_cond_broadcast(&i->state_cond); + pthread_cleanup_push((void(*)(void *)) pthread_mutex_unlock, + (void *) &i->state_lock); + while (i->state == REG_I_WAKE) pthread_cond_wait(&i->state_cond, &i->state_lock); - pthread_mutex_unlock(&i->state_lock); + pthread_cleanup_pop(true); } -- cgit v1.2.3