summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-05-12 18:13:45 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-05-12 18:13:45 +0200
commit50193f69a256cacd27ae74dc0ab01d44a40c6f5a (patch)
tree1093bd9828f5f09a837f3a7ca52d75b2fe53c88a /src
parent488bc8790ab3611ab4b0ccaefb9fefce951501c0 (diff)
downloadouroboros-50193f69a256cacd27ae74dc0ab01d44a40c6f5a.tar.gz
ouroboros-50193f69a256cacd27ae74dc0ab01d44a40c6f5a.zip
irmd: fixed bad locking and added cleanup
flow_alloc_res had missing cleanup, added missing unlock.
Diffstat (limited to 'src')
-rw-r--r--src/irmd/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index aba69224..d266273d 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1006,12 +1006,16 @@ static int flow_alloc_res(int port_id)
}
pthread_mutex_unlock(&instance->r_lock);
- pthread_mutex_lock(&e->res_lock);
while (true) {
+ pthread_mutex_lock(&e->res_lock);
+ pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock,
+ (void*) &e->res_lock);
+
pthread_cond_wait(&e->res_signal, &e->res_lock);
pthread_mutex_unlock(&e->res_lock);
+ pthread_cleanup_pop(0);
pthread_mutex_lock(&instance->r_lock);
e = get_port_map_entry(port_id);
@@ -1032,6 +1036,7 @@ static int flow_alloc_res(int port_id)
}
/* still pending, spurious wake */
+ pthread_mutex_unlock(&instance->r_lock);
}
pthread_mutex_unlock(&instance->r_lock);