summaryrefslogtreecommitdiff
path: root/src/irmd/reg_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/irmd/reg_api.c')
-rw-r--r--src/irmd/reg_api.c5
1 files changed, 4 insertions, 1 deletions
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);
}