From: David Goulet Date: Mon, 10 Dec 2012 21:11:15 +0000 (-0500) Subject: Fix: Allocate stream hash table in respective threads X-Git-Tag: v2.1.0~68 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=04bb2b6422d74dd96498fbdda5fce5cc42cb2f4a;p=lttng-tools.git Fix: Allocate stream hash table in respective threads Allocation and destroy are now in the same thread for both metadata and data hash table. Signed-off-by: David Goulet --- diff --git a/src/common/consumer.c b/src/common/consumer.c index ec73a0add..c561b9bd2 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -2013,6 +2013,12 @@ void *consumer_thread_metadata_poll(void *data) rcu_register_thread(); + metadata_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); + if (!metadata_ht) { + /* ENOMEM at this point. Better to bail out. */ + goto error; + } + DBG("Thread metadata poll started"); /* Size is set to 1 for the consumer_metadata pipe */ @@ -2179,9 +2185,7 @@ end: DBG("Metadata poll thread exiting"); lttng_poll_clean(&events); - if (metadata_ht) { - destroy_stream_ht(metadata_ht); - } + destroy_stream_ht(metadata_ht); rcu_unregister_thread(); return NULL; @@ -2206,6 +2210,7 @@ void *consumer_thread_data_poll(void *data) data_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); if (data_ht == NULL) { + /* ENOMEM at this point. Better to bail out. */ goto end; } @@ -2442,9 +2447,7 @@ end: PERROR("close data pipe"); } - if (data_ht) { - destroy_data_stream_ht(data_ht); - } + destroy_data_stream_ht(data_ht); rcu_unregister_thread(); return NULL; @@ -2633,11 +2636,6 @@ void lttng_consumer_init(void) consumer_data.channel_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); consumer_data.relayd_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); consumer_data.stream_list_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); - - metadata_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); - assert(metadata_ht); - data_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); - assert(data_ht); } /*