X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread.c;h=b91dc5798df67140a43958f5cf87e128bd60acc7;hb=c3e68e71e0bca1c067bf24447163ac6850a9b09e;hp=1ba724337b67ee69a1856087a5c8b65c45a32cd8;hpb=940786035bcaf18b6b19a6a98f928ad4f52375f4;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/notification-thread.c b/src/bin/lttng-sessiond/notification-thread.c index 1ba724337..b91dc5798 100644 --- a/src/bin/lttng-sessiond/notification-thread.c +++ b/src/bin/lttng-sessiond/notification-thread.c @@ -27,6 +27,7 @@ #include "lttng-sessiond.h" #include "health-sessiond.h" #include "thread.h" +#include "testpoint.h" #include "kernel.h" #include @@ -35,6 +36,8 @@ #include #include + +int notifier_consumption_paused; /* * Destroy the thread data previously created by the init function. */ @@ -482,6 +485,7 @@ int init_thread_state(struct notification_thread_handle *handle, if (!state->channels_ht) { goto error; } + state->sessions_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL); if (!state->sessions_ht) { @@ -510,6 +514,9 @@ int init_thread_state(struct notification_thread_handle *handle, if (!state->executor) { goto error; } + + state->restart_poll = false; + mark_thread_as_ready(handle); end: return 0; @@ -571,6 +578,17 @@ static int handle_event_notification_pipe(int event_source_fd, goto end; } + if (testpoint(sessiond_handle_notifier_event_pipe)) { + ret = 0; + goto end; + } + + if (caa_unlikely(notifier_consumption_paused)) { + DBG("Event notifier notification consumption paused, sleeping..."); + sleep(1); + goto end; + } + ret = handle_notification_thread_event_notification( state, event_source_fd, domain); if (ret) { @@ -579,6 +597,7 @@ static int handle_event_notification_pipe(int event_source_fd, ret = -1; goto end; } + end: return ret; } @@ -637,6 +656,10 @@ void *thread_notification(void *data) goto end; } + if (testpoint(sessiond_thread_notification)) { + goto end; + } + while (true) { int fd_count, i; @@ -656,6 +679,12 @@ void *thread_notification(void *data) goto error; } + /* + * Reset restart_poll flag so that calls below might turn it + * on. + */ + state.restart_poll = false; + fd_count = ret; for (i = 0; i < fd_count; i++) { int fd = LTTNG_POLL_GETFD(&state.events, i); @@ -733,6 +762,15 @@ void *thread_notification(void *data) } } } + + /* + * Calls above might have changed the state of the + * FDs in `state.events`. Call _poll_wait() again to + * ensure we have a consistent state. + */ + if (state.restart_poll) { + break; + } } } exit: