diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2017-02-08 23:06:57 +0100 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2017-02-08 23:14:09 +0100 |
commit | 62557fd2a0cf5c749a8262949200019f4bbe8763 (patch) | |
tree | 1ccf39e67ff900147bf05ac40d0bd2542a29b970 /src/ipcpd/normal/gam.c | |
parent | 089c71cdb6bcb3eec696f64818377c80cde9b62f (diff) | |
download | ouroboros-62557fd2a0cf5c749a8262949200019f4bbe8763.tar.gz ouroboros-62557fd2a0cf5c749a8262949200019f4bbe8763.zip |
ipcpd: Add cleanup handler to gam
Diffstat (limited to 'src/ipcpd/normal/gam.c')
-rw-r--r-- | src/ipcpd/normal/gam.c | 5 |
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; } |