From aca897331ff55c80d926b0bdb90f1c8962bf7a6e Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Wed, 10 Aug 2016 12:28:02 +0200 Subject: 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. --- src/irmd/irm_flow.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/irmd/irm_flow.c') 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); -- cgit v1.2.3