diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-08-29 10:50:43 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-08-29 20:32:36 +0200 |
commit | 11ae1b5669356fbaf3405e77d36f517f8c1894cc (patch) | |
tree | a9dbfceba99190181f0d427fb98bb964031d9548 /src/irmd/api_table.c | |
parent | da0739d8dea1235a047095c08cfe67871c3c216e (diff) | |
parent | bb2e24baf3f05c03450defd4c22a8a1279698bb1 (diff) | |
download | ouroboros-11ae1b5669356fbaf3405e77d36f517f8c1894cc.tar.gz ouroboros-11ae1b5669356fbaf3405e77d36f517f8c1894cc.zip |
Merged in dstaesse/ouroboros/be-bugfixing (pull request #228)
Some fixes
Diffstat (limited to 'src/irmd/api_table.c')
-rw-r--r-- | src/irmd/api_table.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/irmd/api_table.c b/src/irmd/api_table.c index 2747ed1a..519b4efe 100644 --- a/src/irmd/api_table.c +++ b/src/irmd/api_table.c @@ -70,6 +70,11 @@ void api_entry_destroy(struct api_entry * e) pthread_mutex_lock(&e->state_lock); + if (e->state == API_DESTROY) { + pthread_mutex_unlock(&e->state_lock); + return; + } + if (e->state == API_SLEEP) e->state = API_DESTROY; @@ -163,6 +168,9 @@ int api_entry_sleep(struct api_entry * e) } } + if (e->state == API_DESTROY) + ret = -1; + e->state = API_INIT; pthread_cond_broadcast(&e->state_cond); pthread_mutex_unlock(&e->state_lock); @@ -177,7 +185,7 @@ void api_entry_wake(struct api_entry * e, struct reg_entry * re) pthread_mutex_lock(&e->state_lock); - if (e->state == API_NULL) { + if (e->state != API_SLEEP) { pthread_mutex_unlock(&e->state_lock); return; } |