X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fust-consumer%2Fust-consumer.c;h=e8e3f9396c9b784ec40d3d98357b9d20aaf04dad;hp=c2ad0fdd8cef613f170f4c43673d5d356fde8f93;hb=6efae65ee1d5c6b048f0f4cd778d784d3857e459;hpb=a98dae5fe5dc81dcf7e5146d3d6915dd6b3d055a diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index c2ad0fdd8..e8e3f9396 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -545,7 +545,9 @@ int lttng_ustconsumer_data_available(struct lttng_consumer_stream *stream) */ ret = pthread_mutex_trylock(&stream->lock); if (ret == EBUSY) { - goto data_not_available; + /* Data not available */ + ret = 0; + goto end; } /* The stream is now locked so we can do our ustctl calls */ @@ -554,14 +556,14 @@ int lttng_ustconsumer_data_available(struct lttng_consumer_stream *stream) /* There is still data so let's put back this subbuffer. */ ret = ustctl_put_subbuf(stream->chan->handle, stream->buf); assert(ret == 0); - pthread_mutex_unlock(&stream->lock); - goto data_not_available; + goto end_unlock; } /* Data is available to be read for this stream. */ - pthread_mutex_unlock(&stream->lock); - return 1; + ret = 1; -data_not_available: - return 0; +end_unlock: + pthread_mutex_unlock(&stream->lock); +end: + return ret; }