X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fconsumer.c;h=f69f0081a9cd77a38798c3dd745cd842cd4f4329;hp=dbec177b7328468b278d0205598e04c574609b53;hb=2e818a6aca8708674e601d3c2c4ff6f6e87c5fca;hpb=f66c074ce00abc984ec7cb57a4fa31b1d9cffd72;ds=sidebyside diff --git a/src/common/consumer.c b/src/common/consumer.c index dbec177b7..f69f0081a 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -554,6 +554,7 @@ static int consumer_add_stream(struct lttng_consumer_stream *stream, DBG3("Adding consumer stream %d", stream->key); pthread_mutex_lock(&consumer_data.lock); + pthread_mutex_lock(&stream->lock); rcu_read_lock(); /* Steal stream identifier to avoid having streams with the same key */ @@ -593,6 +594,7 @@ static int consumer_add_stream(struct lttng_consumer_stream *stream, consumer_data.need_update = 1; rcu_read_unlock(); + pthread_mutex_unlock(&stream->lock); pthread_mutex_unlock(&consumer_data.lock); return ret; @@ -1879,6 +1881,7 @@ static int consumer_add_metadata_stream(struct lttng_consumer_stream *stream, DBG3("Adding metadata stream %d to hash table", stream->wait_fd); pthread_mutex_lock(&consumer_data.lock); + pthread_mutex_lock(&stream->lock); /* * From here, refcounts are updated so be _careful_ when returning an error @@ -1920,6 +1923,7 @@ static int consumer_add_metadata_stream(struct lttng_consumer_stream *stream, rcu_read_unlock(); + pthread_mutex_unlock(&stream->lock); pthread_mutex_unlock(&consumer_data.lock); return ret; }