X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fstream.cpp;h=9f7bfcb15bb513229118302765c8c8f2655f7f91;hb=64803277bbdbe0a943360d918298a48157d9da55;hp=346936d8488f1436186f4b5abf065bf86131d2d7;hpb=ff2aa8f08b117f2a309ed49cf68b135f930093f8;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/stream.cpp b/src/bin/lttng-relayd/stream.cpp index 346936d84..9f7bfcb15 100644 --- a/src/bin/lttng-relayd/stream.cpp +++ b/src/bin/lttng-relayd/stream.cpp @@ -10,18 +10,18 @@ #define _LGPL_SOURCE #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include -#include "lttng-relayd.h" -#include "index.h" -#include "stream.h" -#include "viewer-stream.h" +#include "lttng-relayd.hpp" +#include "index.hpp" +#include "stream.hpp" +#include "viewer-stream.hpp" #include #include @@ -31,6 +31,8 @@ /* Should be called with RCU read-side lock held. */ bool stream_get(struct relay_stream *stream) { + ASSERT_RCU_READ_LOCKED(); + return urcu_ref_get_unless_zero(&stream->ref); } @@ -71,7 +73,7 @@ static void stream_complete_rotation(struct relay_stream *stream) } lttng_trace_chunk_put(stream->trace_chunk); stream->trace_chunk = stream->ongoing_rotation.value.next_trace_chunk; - stream->ongoing_rotation = (typeof(stream->ongoing_rotation)) {}; + stream->ongoing_rotation = LTTNG_OPTIONAL_INIT_UNSET; stream->completed_rotation_count++; } @@ -578,7 +580,7 @@ struct relay_stream *stream_create(struct ctf_trace *trace, bool acquired_reference = false; struct lttng_trace_chunk *current_trace_chunk; - stream = (relay_stream *) zmalloc(sizeof(struct relay_stream)); + stream = zmalloc(); if (stream == NULL) { PERROR("relay stream zmalloc"); goto error_no_alloc;