From 6dfb57e2f61f405680eff9b9d3032c14abb516d2 Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Thu, 19 Sep 2013 15:26:49 -0400 Subject: [PATCH] * #30347: socket_pair: remove ScopedLock --- daemon/src/video/socket_pair.cpp | 7 +------ daemon/src/video/socket_pair.h | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/daemon/src/video/socket_pair.cpp b/daemon/src/video/socket_pair.cpp index 775496e330..095806fe6e 100644 --- a/daemon/src/video/socket_pair.cpp +++ b/daemon/src/video/socket_pair.cpp @@ -32,7 +32,6 @@ #include "libav_deps.h" #include "socket_pair.h" -#include "scoped_lock.h" #include "libav_utils.h" #include "logger.h" @@ -144,7 +143,6 @@ SocketPair::SocketPair(const char *uri, int localPort) : rtcpDestAddrLen_(), interrupted_(false) { - pthread_mutex_init(&rtcpWriteMutex_, NULL); openSockets(uri, localPort); } @@ -152,9 +150,6 @@ SocketPair::~SocketPair() { interrupted_ = true; closeSockets(); - - // destroy in reverse order - pthread_mutex_destroy(&rtcpWriteMutex_); } void SocketPair::interrupt() @@ -290,7 +285,7 @@ int SocketPair::writeCallback(void *opaque, uint8_t *buf, int buf_size) if (RTP_PT_IS_RTCP(buf[1])) { /* RTCP payload type */ - sfl::ScopedLock lock(context->rtcpWriteMutex_); + std::lock_guard<std::mutex> lock(context->rtcpWriteMutex_); ret = ff_network_wait_fd(context->rtcpHandle_); if (ret < 0) return ret; diff --git a/daemon/src/video/socket_pair.h b/daemon/src/video/socket_pair.h index 7329aa13bd..b6b8769825 100644 --- a/daemon/src/video/socket_pair.h +++ b/daemon/src/video/socket_pair.h @@ -35,7 +35,7 @@ #include "video_base.h" #include <sys/socket.h> -#include <pthread.h> +#include <mutex> #include <stdint.h> namespace sfl_video { @@ -55,7 +55,7 @@ namespace sfl_video { private: NON_COPYABLE(SocketPair); - pthread_mutex_t rtcpWriteMutex_; + std::mutex rtcpWriteMutex_; int rtpHandle_; int rtcpHandle_; -- GitLab