X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconsumer%2Fconsumer-timer.c;h=8c39275d55b3af1d0978e3bad68c9c0326239a08;hb=5383626cf594a00a88ae4c99ed34797efc3ced2c;hp=931f7471fc6fe974982ff1cb687750ff68f80a7c;hpb=69f60d21c627ad2fcae6d25fecf91e639c6ded33;p=lttng-tools.git diff --git a/src/common/consumer/consumer-timer.c b/src/common/consumer/consumer-timer.c index 931f7471f..8c39275d5 100644 --- a/src/common/consumer/consumer-timer.c +++ b/src/common/consumer/consumer-timer.c @@ -61,6 +61,10 @@ static void setmask(sigset_t *mask) if (ret) { PERROR("sigaddset live"); } + ret = sigaddset(mask, LTTNG_CONSUMER_SIG_EXIT); + if (ret) { + PERROR("sigaddset exit"); + } } /* @@ -148,7 +152,7 @@ int consumer_flush_kernel_index(struct lttng_consumer_stream *stream) } ret = kernctl_snapshot(stream->wait_fd); if (ret < 0) { - if (errno != EAGAIN && errno != ENODATA) { + if (ret != -EAGAIN && ret != -ENODATA) { PERROR("live timer kernel snapshot"); ret = -1; goto end; @@ -381,7 +385,7 @@ void consumer_timer_signal_thread_qs(unsigned int signr) if (ret == -1) { PERROR("sigpending"); } - if (!sigismember(&pending_set, LTTNG_CONSUMER_SIG_SWITCH)) { + if (!sigismember(&pending_set, signr)) { break; } caa_cpu_relax(); @@ -546,7 +550,8 @@ int consumer_signal_init(void) /* * This thread is the sighandler for signals LTTNG_CONSUMER_SIG_SWITCH, - * LTTNG_CONSUMER_SIG_TEARDOWN and LTTNG_CONSUMER_SIG_LIVE. + * LTTNG_CONSUMER_SIG_TEARDOWN, LTTNG_CONSUMER_SIG_LIVE, and + * LTTNG_CONSUMER_SIG_EXIT. */ void *consumer_timer_thread(void *data) { @@ -589,6 +594,9 @@ void *consumer_timer_thread(void *data) DBG("Signal timer metadata thread teardown"); } else if (signr == LTTNG_CONSUMER_SIG_LIVE) { live_timer(ctx, info.si_signo, &info, NULL); + } else if (signr == LTTNG_CONSUMER_SIG_EXIT) { + assert(consumer_quit); + goto end; } else { ERR("Unexpected signal %d\n", info.si_signo); } @@ -597,10 +605,8 @@ void *consumer_timer_thread(void *data) error_testpoint: /* Only reached in testpoint error */ health_error(); +end: health_unregister(health_consumerd); - rcu_unregister_thread(); - - /* Never return */ return NULL; }