summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-08 23:06:57 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-08 23:14:09 +0100
commit62557fd2a0cf5c749a8262949200019f4bbe8763 (patch)
tree1ccf39e67ff900147bf05ac40d0bd2542a29b970 /src/ipcpd/normal
parent089c71cdb6bcb3eec696f64818377c80cde9b62f (diff)
downloadouroboros-62557fd2a0cf5c749a8262949200019f4bbe8763.tar.gz
ouroboros-62557fd2a0cf5c749a8262949200019f4bbe8763.zip
ipcpd: Add cleanup handler to gam
Diffstat (limited to 'src/ipcpd/normal')
-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;
}