diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-05-12 18:13:45 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-05-12 18:13:45 +0200 |
commit | 50193f69a256cacd27ae74dc0ab01d44a40c6f5a (patch) | |
tree | 1093bd9828f5f09a837f3a7ca52d75b2fe53c88a /src/irmd | |
parent | 488bc8790ab3611ab4b0ccaefb9fefce951501c0 (diff) | |
download | ouroboros-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/irmd')
-rw-r--r-- | src/irmd/main.c | 7 |
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); |