X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=stream.cpp;h=3a4ccc3ed88065a87738796e00e0b0cda627fb55;hp=d7a78a602098ab5d77dda08873af8c3d7b29e11b;hb=50651c954803c1941e6ad1bb494712891c18f7d2;hpb=f0621e41fdb96ce1bd58e7561e0aa76345072ba3 diff --git a/stream.cpp b/stream.cpp index d7a78a6..3a4ccc3 100644 --- a/stream.cpp +++ b/stream.cpp @@ -13,7 +13,6 @@ #include "log.h" #include "metacube2.h" -#include "mutexlock.h" #include "state.pb.h" #include "stream.h" #include "util.h" @@ -31,8 +30,6 @@ Stream::Stream(const string &url, size_t backlog_size, size_t prebuffering_bytes if (data_fd == -1) { exit(1); } - - pthread_mutex_init(&queued_data_mutex, nullptr); } Stream::~Stream() @@ -65,8 +62,6 @@ Stream::Stream(const StreamProto &serialized, int data_fd) } suitable_starting_points.push_back(point); } - - pthread_mutex_init(&queued_data_mutex, nullptr); } StreamProto Stream::serialize() @@ -232,7 +227,7 @@ void Stream::add_data_deferred(const char *data, size_t bytes, uint16_t metacube return; } - MutexLock lock(&queued_data_mutex); + lock_guard lock(queued_data_mutex); DataElement data_element; data_element.metacube_flags = metacube_flags; @@ -271,7 +266,7 @@ void Stream::process_queued_data() // Hold the lock for as short as possible, since add_data_raw() can possibly // write to disk, which might disturb the input thread. { - MutexLock lock(&queued_data_mutex); + lock_guard lock(queued_data_mutex); if (queued_data.empty()) { return; }