*/
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 */
/* There is still data so let's put back this subbuffer. */
ret = kernctl_put_subbuf(stream->wait_fd);
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;
}
*/
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 */
/* 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;
}