X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread.c;h=4ce38e180e106986ae630a0c85483e93568405a3;hp=62d47ee54182cfc3da2a27d3dbf4ba37638a67f4;hb=ea9a44f03f3f6e144b5f7f312eee2a5f7a849ecb;hpb=8abe313a6c4f251063e4b72ddd47ce8107384d71 diff --git a/src/bin/lttng-sessiond/notification-thread.c b/src/bin/lttng-sessiond/notification-thread.c index 62d47ee54..4ce38e180 100644 --- a/src/bin/lttng-sessiond/notification-thread.c +++ b/src/bin/lttng-sessiond/notification-thread.c @@ -85,7 +85,8 @@ end: struct notification_thread_handle *notification_thread_handle_create( struct lttng_pipe *ust32_channel_monitor_pipe, struct lttng_pipe *ust64_channel_monitor_pipe, - struct lttng_pipe *kernel_channel_monitor_pipe) + struct lttng_pipe *kernel_channel_monitor_pipe, + sem_t *notification_thread_ready) { int ret; struct notification_thread_handle *handle; @@ -141,6 +142,7 @@ struct notification_thread_handle *notification_thread_handle_create( } else { handle->channel_monitoring_pipes.kernel_consumer = -1; } + handle->notification_thread_ready = notification_thread_ready; end: return handle; error: @@ -357,6 +359,14 @@ void fini_thread_state(struct notification_thread_state *state) ret = cds_lfht_destroy(state->sessions_ht, NULL); assert(!ret); } + /* + * Must be destroyed after all channels have been destroyed. + * See comment in struct lttng_session_trigger_list. + */ + if (state->session_triggers_ht) { + ret = cds_lfht_destroy(state->session_triggers_ht, NULL); + assert(!ret); + } if (state->notification_channel_socket >= 0) { notification_channel_socket_destroy( state->notification_channel_socket); @@ -405,6 +415,12 @@ int init_thread_state(struct notification_thread_handle *handle, goto error; } + state->session_triggers_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0, + CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL); + if (!state->session_triggers_ht) { + goto error; + } + state->channel_state_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL); if (!state->channel_state_ht) { @@ -432,6 +448,7 @@ int init_thread_state(struct notification_thread_handle *handle, if (!state->triggers_ht) { goto error; } + sem_post(handle->notification_thread_ready); end: return 0; error: