summaryrefslogtreecommitdiff
path: root/src/irmd/irm_flow.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-10 12:28:02 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-10 13:03:15 +0200
commitaca897331ff55c80d926b0bdb90f1c8962bf7a6e (patch)
treec71b8d8c6b35ad012f4a8bb673749275fa3806bf /src/irmd/irm_flow.c
parent27c99995c8059eb897b704d84596ca0abca6db9b (diff)
downloadouroboros-aca897331ff55c80d926b0bdb90f1c8962bf7a6e.tar.gz
ouroboros-aca897331ff55c80d926b0bdb90f1c8962bf7a6e.zip
irmd: Graceful shutdown
Threads from the threadpool will now check the state of the IRMd and exit gracefully without a need to cancel them. This avoids the unsafe call of pthread_cancel in the signal handler.
Diffstat (limited to 'src/irmd/irm_flow.c')
-rw-r--r--src/irmd/irm_flow.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/irmd/irm_flow.c b/src/irmd/irm_flow.c
index bf67f2ce..d9fe3fb3 100644
--- a/src/irmd/irm_flow.c
+++ b/src/irmd/irm_flow.c
@@ -65,13 +65,10 @@ void irm_flow_destroy(struct irm_flow * f)
pthread_cond_signal(&f->state_cond);
- pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock,
- (void *) &f->state_lock);
-
while (f->state != FLOW_NULL)
pthread_cond_wait(&f->state_cond, &f->state_lock);
- pthread_cleanup_pop(true);
+ pthread_mutex_unlock(&f->state_lock);
pthread_cond_destroy(&f->state_cond);
pthread_mutex_destroy(&f->state_lock);