summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/gam.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipcpd/normal/gam.c')
-rw-r--r--src/ipcpd/normal/gam.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ipcpd/normal/gam.c b/src/ipcpd/normal/gam.c
index fae34dfe..36025f85 100644
--- a/src/ipcpd/normal/gam.c
+++ b/src/ipcpd/normal/gam.c
@@ -283,6 +283,9 @@ int gam_flow_wait(struct gam * instance,
pthread_mutex_lock(&instance->gas_lock);
+ pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock,
+ (void *) &instance->gas_lock);
+
while (list_is_empty(&instance->gas))
pthread_cond_wait(&instance->gas_cond, &instance->gas_lock);
@@ -299,7 +302,7 @@ int gam_flow_wait(struct gam * instance,
list_del(&ga->next);
free(ga);
- pthread_mutex_unlock(&instance->gas_lock);
+ pthread_cleanup_pop(true);
return 0;
}