diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am
index 50360bc2115ecadfa7f8df2da681e9ba3fe9b2c0..045fabc8f5220e7894317ac9f95bcc6d7b528c2c 100644
--- a/daemon/src/Makefile.am
+++ b/daemon/src/Makefile.am
@@ -84,8 +84,6 @@ libsflphone_la_SOURCES = conference.cpp \
 		logger.cpp \
 		numbercleaner.cpp \
 		fileutils.cpp \
-		scoped_lock.cpp \
-		scoped_lock.h \
 		sflthread.cpp \
 		sflthread.h \
 		conference.h \
diff --git a/daemon/src/audio/audiolayer.cpp b/daemon/src/audio/audiolayer.cpp
index 309d49dee27e7ef2d84f7dc99805ea8476a8cf64..b02bcf10059f255788afb5063e82e089d07ca6ed 100644
--- a/daemon/src/audio/audiolayer.cpp
+++ b/daemon/src/audio/audiolayer.cpp
@@ -33,7 +33,6 @@
 #include "audiolayer.h"
 #include "audio/dcblocker.h"
 #include "manager.h"
-#include "scoped_lock.h"
 
 AudioLayer::AudioLayer()
     : captureGain_(1.0)
@@ -47,31 +46,25 @@ AudioLayer::AudioLayer()
     , converter_(sampleRate_)
     , lastNotificationTime_(0)
 {
-    pthread_mutex_init(&mutex_, NULL);
     urgentRingBuffer_.createReadPointer(MainBuffer::DEFAULT_ID);
 }
 
-AudioLayer::~AudioLayer()
-{
-    pthread_mutex_destroy(&mutex_);
-}
-
 void AudioLayer::flushMain()
 {
-    sfl::ScopedLock guard(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
     // should pass call id
     Manager::instance().getMainBuffer().flushAllBuffers();
 }
 
 void AudioLayer::flushUrgent()
 {
-    sfl::ScopedLock guard(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
     urgentRingBuffer_.flushAll();
 }
 
 void AudioLayer::putUrgent(AudioBuffer& buffer)
 {
-    sfl::ScopedLock guard(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
     urgentRingBuffer_.put(buffer);
 }
 
diff --git a/daemon/src/audio/audiolayer.h b/daemon/src/audio/audiolayer.h
index 4c95649a929d5ce0af2fa1a6f9c207c25f77f819..6ad8154aeaec45f0e169fd553e84cffb1d62d577 100644
--- a/daemon/src/audio/audiolayer.h
+++ b/daemon/src/audio/audiolayer.h
@@ -34,7 +34,7 @@
 #ifndef AUDIO_LAYER_H_
 #define AUDIO_LAYER_H_
 
-#include <pthread.h>
+#include <mutex>
 #include <sys/time.h>
 #include <vector>
 #include "ringbuffer.h"
@@ -80,7 +80,7 @@ class AudioLayer {
         };
 
         AudioLayer();
-        virtual ~AudioLayer();
+        virtual ~AudioLayer() = default;
 
         virtual std::vector<std::string> getCaptureDeviceList() const = 0;
         virtual std::vector<std::string> getPlaybackDeviceList() const = 0;
@@ -216,7 +216,7 @@ class AudioLayer {
         /**
          * Lock for the entire audio layer
          */
-        pthread_mutex_t mutex_;
+        std::mutex mutex_;
 
         /**
          * Remove audio offset that can be introduced by certain cheap audio device
diff --git a/daemon/src/audio/audiortp/audio_rtp_factory.cpp b/daemon/src/audio/audiortp/audio_rtp_factory.cpp
index f466a59985fefc34de4f5972ae068e060a36c755..46d3b82677118751bdb18e47770238d52c0d85e6 100644
--- a/daemon/src/audio/audiortp/audio_rtp_factory.cpp
+++ b/daemon/src/audio/audiortp/audio_rtp_factory.cpp
@@ -42,7 +42,6 @@
 #include "sip/sipcall.h"
 #include "sip/sipaccount.h"
 #include "sip/sdes_negotiator.h"
-#include "scoped_lock.h"
 #include "logger.h"
 
 namespace sfl {
@@ -55,14 +54,11 @@ AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : rtpSession_(NULL),
     cachedRemoteMasterSalt_(MAX_MASTER_SALT_LENGTH),
     remoteOfferIsSet_(false), ca_(ca),
     keyExchangeProtocol_(NONE)
-{
-    pthread_mutex_init(&audioRtpThreadMutex_, NULL);
-}
+{}
 
 AudioRtpFactory::~AudioRtpFactory()
 {
     delete rtpSession_;
-    pthread_mutex_destroy(&audioRtpThreadMutex_);
 }
 
 void AudioRtpFactory::initConfig()
@@ -105,7 +101,7 @@ void AudioRtpFactory::initConfig()
 
 void AudioRtpFactory::initSession()
 {
-    ScopedLock m(audioRtpThreadMutex_);
+    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
 
     if (srtpEnabled_) {
         const std::string zidFilename(Manager::instance().voipPreferences.getZidFile());
@@ -151,7 +147,7 @@ void AudioRtpFactory::start(const std::vector<AudioCodec*> &audioCodecs)
 
 void AudioRtpFactory::stop()
 {
-    ScopedLock mutex(audioRtpThreadMutex_);
+    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
 
     delete rtpSession_;
     rtpSession_ = NULL;
diff --git a/daemon/src/audio/audiortp/audio_rtp_factory.h b/daemon/src/audio/audiortp/audio_rtp_factory.h
index 7c72a33b9a2d0891ed8c68e0b88a461c1de56f80..1a43270b28fb9d115b3575a4dd6792e1ecd9265f 100644
--- a/daemon/src/audio/audiortp/audio_rtp_factory.h
+++ b/daemon/src/audio/audiortp/audio_rtp_factory.h
@@ -33,8 +33,7 @@
 
 #include <ccrtp/CryptoContext.h>
 #include <stdexcept>
-#include <tr1/array>
-#include <pthread.h>
+#include <mutex>
 #include "audio_rtp_session.h"
 #include "audio_srtp_session.h"
 #include "noncopyable.h"
@@ -159,7 +158,7 @@ class AudioRtpFactory {
         NON_COPYABLE(AudioRtpFactory);
         enum KeyExchangeProtocol { NONE, SDES, ZRTP };
         AudioRtpSession *rtpSession_;
-        pthread_mutex_t audioRtpThreadMutex_;
+        std::mutex audioRtpThreadMutex_;
 
         // Field used when initializing audio rtp session
         // May be set manually or from config using initAudioRtpConfig
diff --git a/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp b/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp
index 33e8bd4d0d12039a3ec7101e768c3b800860ef8f..a56065ebdfe4c161e729ddd1d523f0cbb6988cc7 100644
--- a/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp
+++ b/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp
@@ -38,7 +38,6 @@
 #include "logger.h"
 #include "sip/sipcall.h"
 #include "audio/audiolayer.h"
-#include "scoped_lock.h"
 #include "manager.h"
 
 namespace sfl {
@@ -115,12 +114,7 @@ AudioRtpRecord::AudioRtpRecord() :
     , dtmfPayloadType_(101) // same as Asterisk
     , dead_(false)
     , currentCodecIndex_(0)
-{
-    pthread_mutex_init(&audioCodecMutex_, NULL);
-#if HAVE_SPEEXDSP
-    pthread_mutex_init(&audioProcessMutex_, NULL);
-#endif
-}
+{}
 
 // Call from processData*
 bool AudioRtpRecord::isDead()
@@ -182,22 +176,17 @@ AudioRtpRecord::~AudioRtpRecord()
     delete converterDecode_;
     converterDecode_ = 0;
     {
-        ScopedLock lock(audioCodecMutex_);
+        std::lock_guard<std::mutex> lock(audioCodecMutex_);
         deleteCodecs();
     }
 #if HAVE_SPEEXDSP
     {
-        ScopedLock lock(audioProcessMutex_);
+        std::lock_guard<std::mutex> lock(audioProcessMutex_);
         delete noiseSuppressDecode_;
         noiseSuppressDecode_ = 0;
         delete noiseSuppressEncode_;
         noiseSuppressEncode_ = 0;
     }
-#endif
-    pthread_mutex_destroy(&audioCodecMutex_);
-
-#if HAVE_SPEEXDSP
-    pthread_mutex_destroy(&audioProcessMutex_);
 #endif
 }
 
@@ -217,7 +206,7 @@ std::string
 AudioRtpRecordHandler::getCurrentAudioCodecNames()
 {
     std::string result;
-    ScopedLock lock(audioRtpRecord_.audioCodecMutex_);
+    std::lock_guard<std::mutex> lock(audioRtpRecord_.audioCodecMutex_);
     {
         std::string sep = "";
 
@@ -234,7 +223,7 @@ AudioRtpRecordHandler::getCurrentAudioCodecNames()
 
 void AudioRtpRecordHandler::setRtpMedia(const std::vector<AudioCodec*> &audioCodecs)
 {
-    ScopedLock lock(audioRtpRecord_.audioCodecMutex_);
+    std::lock_guard<std::mutex> lock(audioRtpRecord_.audioCodecMutex_);
 
     audioRtpRecord_.deleteCodecs();
     // Set various codec info to reduce indirection
@@ -268,7 +257,7 @@ void AudioRtpRecordHandler::initBuffers()
 #if HAVE_SPEEXDSP
 void AudioRtpRecordHandler::initNoiseSuppress()
 {
-    ScopedLock lock(audioRtpRecord_.audioProcessMutex_);
+    std::lock_guard<std::mutex> lock(audioRtpRecord_.audioProcessMutex_);
     delete audioRtpRecord_.noiseSuppressEncode_;
     audioRtpRecord_.noiseSuppressEncode_ = new NoiseSuppress(getCodecFrameSize(), getCodecSampleRate());
     delete audioRtpRecord_.noiseSuppressDecode_;
@@ -334,7 +323,7 @@ int AudioRtpRecordHandler::processDataEncode()
 #if HAVE_SPEEXDSP
 
     if (Manager::instance().audioPreference.getNoiseReduce()) {
-        ScopedLock lock(audioRtpRecord_.audioProcessMutex_);
+        std::lock_guard<std::mutex> lock(audioRtpRecord_.audioProcessMutex_);
         RETURN_IF_NULL(audioRtpRecord_.noiseSuppressEncode_, 0, "Noise suppressor already destroyed");
         audioRtpRecord_.noiseSuppressEncode_->process(micData, getCodecFrameSize());
     }
@@ -346,7 +335,7 @@ int AudioRtpRecordHandler::processDataEncode()
 #endif
 
     {
-        ScopedLock lock(audioRtpRecord_.audioCodecMutex_);
+        std::lock_guard<std::mutex> lock(audioRtpRecord_.audioCodecMutex_);
         RETURN_IF_NULL(audioRtpRecord_.getCurrentCodec(), 0, "Audio codec already destroyed");
         unsigned char *micDataEncoded = audioRtpRecord_.encodedData_.data();
         return audioRtpRecord_.getCurrentCodec()->encode(micDataEncoded, out->getData(), getCodecFrameSize());
@@ -378,7 +367,7 @@ void AudioRtpRecordHandler::processDataDecode(unsigned char *spkrData, size_t si
     size = std::min(size, audioRtpRecord_.decData_.frames());
 
     {
-        ScopedLock lock(audioRtpRecord_.audioCodecMutex_);
+        std::lock_guard<std::mutex> lock(audioRtpRecord_.audioCodecMutex_);
         RETURN_IF_NULL(audioRtpRecord_.getCurrentCodec(), "Audio codecs already destroyed");
         // Return the size of data in samples
         audioRtpRecord_.getCurrentCodec()->decode(audioRtpRecord_.decData_.getData(), spkrData, size);
@@ -392,7 +381,7 @@ void AudioRtpRecordHandler::processDataDecode(unsigned char *spkrData, size_t si
 #if HAVE_SPEEXDSP
 
     if (Manager::instance().audioPreference.getNoiseReduce()) {
-        ScopedLock lock(audioRtpRecord_.audioProcessMutex_);
+        std::lock_guard<std::mutex> lock(audioRtpRecord_.audioProcessMutex_);
         RETURN_IF_NULL(audioRtpRecord_.noiseSuppressDecode_, "Noise suppressor already destroyed");
         audioRtpRecord_.noiseSuppressDecode_->process(audioRtpRecord_.decData_, getCodecFrameSize());
     }
diff --git a/daemon/src/audio/audiortp/audio_rtp_record_handler.h b/daemon/src/audio/audiortp/audio_rtp_record_handler.h
index 87fb83a0eb7e1468c06ac78598d1696440a967d4..d2c37302775fc11098a044f56f2f57f4327b8c0e 100644
--- a/daemon/src/audio/audiortp/audio_rtp_record_handler.h
+++ b/daemon/src/audio/audiortp/audio_rtp_record_handler.h
@@ -42,7 +42,7 @@ using std::ptrdiff_t;
 #include <ccrtp/rtp.h>
 #include <tr1/array>
 #include <list>
-#include <pthread.h>
+#include <mutex>
 
 #include "noncopyable.h"
 #include "audio/codecs/audiocodec.h"
@@ -89,7 +89,7 @@ class AudioRtpRecord {
 
     private:
         std::vector<AudioCodec*> audioCodecs_;
-        pthread_mutex_t audioCodecMutex_;
+        std::mutex audioCodecMutex_;
         // these will have the same value unless we are sending
         // a different codec than we are receiving (asymmetric RTP)
         int encoderPayloadType_;
@@ -107,7 +107,7 @@ class AudioRtpRecord {
 #if HAVE_SPEEXDSP
         NoiseSuppress *noiseSuppressEncode_;
         NoiseSuppress *noiseSuppressDecode_;
-        pthread_mutex_t audioProcessMutex_;
+        std::mutex audioProcessMutex_;
 #endif
 
         unsigned int dtmfPayloadType_;
diff --git a/daemon/src/call.cpp b/daemon/src/call.cpp
index 7fef6779c84506c5e72b4d7243140da265042382..4a8012b0246f627eb0bf280eb932b1742f0bb24c 100644
--- a/daemon/src/call.cpp
+++ b/daemon/src/call.cpp
@@ -32,7 +32,6 @@
 #include "manager.h"
 #include "audio/mainbuffer.h"
 #include "history/historyitem.h"
-#include "scoped_lock.h"
 
 Call::Call(const std::string& id, Call::CallType type, const std::string &accountID)
     : callMutex_()
@@ -51,40 +50,37 @@ Call::Call(const std::string& id, Call::CallType type, const std::string &accoun
     , timestamp_start_(0)
     , timestamp_stop_(0)
 {
-    pthread_mutex_init(&callMutex_, NULL);
     time(&timestamp_start_);
 }
 
 Call::~Call()
-{
-    pthread_mutex_destroy(&callMutex_);
-}
+{}
 
 void
 Call::setConnectionState(ConnectionState state)
 {
-    sfl::ScopedLock m(callMutex_);
+    std::lock_guard<std::mutex> lock(callMutex_);
     connectionState_ = state;
 }
 
 Call::ConnectionState
 Call::getConnectionState()
 {
-    sfl::ScopedLock m(callMutex_);
+    std::lock_guard<std::mutex> lock(callMutex_);
     return connectionState_;
 }
 
 void
 Call::setState(CallState state)
 {
-    sfl::ScopedLock m(callMutex_);
+    std::lock_guard<std::mutex> lock(callMutex_);
     callState_ = state;
 }
 
 Call::CallState
 Call::getState()
 {
-    sfl::ScopedLock m(callMutex_);
+    std::lock_guard<std::mutex> lock(callMutex_);
     return callState_;
 }
 
@@ -129,21 +125,21 @@ Call::getStateStr()
 std::string
 Call::getLocalIp()
 {
-    sfl::ScopedLock m(callMutex_);
+    std::lock_guard<std::mutex> lock(callMutex_);
     return localIPAddress_;
 }
 
 unsigned int
 Call::getLocalAudioPort()
 {
-    sfl::ScopedLock m(callMutex_);
+    std::lock_guard<std::mutex> lock(callMutex_);
     return localAudioPort_;
 }
 
 unsigned int
 Call::getLocalVideoPort()
 {
-    sfl::ScopedLock m(callMutex_);
+    std::lock_guard<std::mutex> lock(callMutex_);
     return localVideoPort_;
 }
 
diff --git a/daemon/src/call.h b/daemon/src/call.h
index cced9446e8e27f49694b797b9efe78ba4ee943ed..41ba244ce24ced424a2abf13473a591eebdf4890 100644
--- a/daemon/src/call.h
+++ b/daemon/src/call.h
@@ -34,7 +34,7 @@
 
 #include <sstream>
 #include <map>
-#include <pthread.h>
+#include <mutex>
 #include "audio/recordable.h"
 
 /*
@@ -233,7 +233,7 @@ class Call : public Recordable {
     private:
         std::string getTypeStr() const;
         /** Protect every attribute that can be changed by two threads */
-        pthread_mutex_t callMutex_;
+        std::mutex callMutex_;
 
         // Informations about call socket / audio
 
diff --git a/daemon/src/history/history.cpp b/daemon/src/history/history.cpp
index 3ceff215a1ee7f6a7c9a4a59afd4133eb3ef9537..d1590345ba86eaaa6c9fbd33cdde8ff6e819d032 100644
--- a/daemon/src/history/history.cpp
+++ b/daemon/src/history/history.cpp
@@ -37,28 +37,19 @@
 #include <sys/stat.h> // for mkdir
 #include <ctime>
 #include <cstring>
-#include "scoped_lock.h"
 #include "fileutils.h"
 #include "logger.h"
 #include "call.h"
 
 namespace sfl {
 
+History::History() : historyItemsMutex_(), items_(), path_() {}
+
 
 using std::map;
 using std::string;
 using std::vector;
 
-History::History() : historyItemsMutex_(), items_(), path_("")
-{
-    pthread_mutex_init(&historyItemsMutex_, NULL);
-}
-
-History::~History()
-{
-    pthread_mutex_destroy(&historyItemsMutex_);
-}
-
 bool History::load(int limit)
 {
     ensurePath();
@@ -79,7 +70,7 @@ bool History::load(int limit)
 
 bool History::save()
 {
-    sfl::ScopedLock lock(historyItemsMutex_);
+    std::lock_guard<std::mutex> lock(historyItemsMutex_);
     DEBUG("Saving history in XDG directory: %s", path_.c_str());
     ensurePath();
     std::sort(items_.begin(), items_.end());
@@ -93,7 +84,7 @@ bool History::save()
 
 void History::addEntry(const HistoryItem &item, int oldest)
 {
-    sfl::ScopedLock lock(historyItemsMutex_);
+    std::lock_guard<std::mutex> lock(historyItemsMutex_);
     if (item.hasPeerNumber() and item.youngerThan(oldest))
         items_.push_back(item);
 }
@@ -126,7 +117,7 @@ void History::ensurePath()
 
 vector<map<string, string> > History::getSerialized()
 {
-    sfl::ScopedLock lock(historyItemsMutex_);
+    std::lock_guard<std::mutex> lock(historyItemsMutex_);
     vector<map<string, string> > result;
     for (const auto &item : items_)
         result.push_back(item.toMap());
@@ -152,20 +143,20 @@ void History::addCall(Call *call, int limit)
 
 void History::clear()
 {
-    sfl::ScopedLock lock(historyItemsMutex_);
+    std::lock_guard<std::mutex> lock(historyItemsMutex_);
     items_.clear();
 }
 
 bool History::empty()
 {
-    sfl::ScopedLock lock(historyItemsMutex_);
+    std::lock_guard<std::mutex> lock(historyItemsMutex_);
     return items_.empty();
 }
 
 
 size_t History::numberOfItems()
 {
-    sfl::ScopedLock lock(historyItemsMutex_);
+    std::lock_guard<std::mutex> lock(historyItemsMutex_);
     return items_.size();
 }
 
diff --git a/daemon/src/history/history.h b/daemon/src/history/history.h
index cc94cc7ec011d0295412cda33f8b395adf4bab7e..f0ba803a37233c1b920d686ed72225b27016deae 100644
--- a/daemon/src/history/history.h
+++ b/daemon/src/history/history.h
@@ -34,7 +34,7 @@
 #define HISTORY_
 
 #include "historyitem.h"
-#include <pthread.h>
+#include <mutex>
 #include <vector>
 
 class Call;
@@ -45,8 +45,6 @@ class History {
 
     public:
         History();
-        ~History();
-
         /** Load history from file */
         bool load(int limit);
 
@@ -69,7 +67,7 @@ class History {
         void setPath(const std::string &path);
     private:
         /* Mutex to protect the history items */
-        pthread_mutex_t historyItemsMutex_;
+        std::mutex historyItemsMutex_;
 
         /* If no path has been set, this will initialize path to a
          * system-dependent location */
diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp
index e2eefabcf1b57eabf1ee89bf24a507bb72ed7520..2b0792bc5ee8d21bf5a2870f981c2ed2ea1efc97 100644
--- a/daemon/src/iax/iaxvoiplink.cpp
+++ b/daemon/src/iax/iaxvoiplink.cpp
@@ -43,28 +43,24 @@
 #include "audio/audiolayer.h"
 #include "audio/samplerateconverter.h"
 #include "array_size.h"
-#include "scoped_lock.h"
 #include "map_utils.h"
 
 AccountMap IAXVoIPLink::iaxAccountMap_;
 IAXCallMap IAXVoIPLink::iaxCallMap_;
-// has same effect as pthread_mutex_init with default args, but for a statically
-// allocated mutex
-pthread_mutex_t IAXVoIPLink::iaxCallMapMutex_ = PTHREAD_MUTEX_INITIALIZER;
+std::mutex IAXVoIPLink::iaxCallMapMutex_;
 
 IAXVoIPLink::IAXVoIPLink(const std::string& accountID) :
     regSession_(NULL)
     , nextRefreshStamp_(0)
     , mutexIAX_()
     , decData_(DEC_BUFFER_SIZE)
-    , resampledData_(DEC_BUFFER_SIZE*4)
+    , resampledData_(DEC_BUFFER_SIZE * 4)
     , encodedData_()
     , converter_(44100)
     , initDone_(false)
     , accountID_(accountID)
     , evThread_(this)
 {
-    pthread_mutex_init(&mutexIAX_, NULL);
     srand(time(NULL));    // to get random number for RANDOM_PORT
 }
 
@@ -78,7 +74,6 @@ IAXVoIPLink::~IAXVoIPLink()
     // This is our last account
     if (iaxAccountMap_.size() == 1)
         clearIaxCallMap();
-    pthread_mutex_destroy(&mutexIAX_);
 }
 
 void
@@ -103,13 +98,13 @@ IAXVoIPLink::terminate()
     if (!initDone_)
         return;
 
-    sfl::ScopedLock m(iaxCallMapMutex_);
+    std::lock_guard<std::mutex> lock(iaxCallMapMutex_);
 
-    for (auto &item : iaxCallMap_) {
+    for (auto & item : iaxCallMap_) {
         IAXCall *call = static_cast<IAXCall*>(item.second);
 
         if (call) {
-            sfl::ScopedLock lock(mutexIAX_);
+            std::lock_guard<std::mutex> lock(mutexIAX_);
             iax_hangup(call->session, const_cast<char*>("Dumped Call"));
             delete call;
         }
@@ -126,7 +121,7 @@ IAXVoIPLink::getEvent()
     iax_event *event = NULL;
 
     {
-        sfl::ScopedLock lock(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         event = iax_get_event(0);
     }
 
@@ -134,7 +129,7 @@ IAXVoIPLink::getEvent()
 
         // If we received an 'ACK', libiax2 tells apps to ignore them.
         if (event->etype == IAX_EVENT_NULL) {
-            sfl::ScopedLock lock(mutexIAX_);
+            std::lock_guard<std::mutex> lock(mutexIAX_);
             iax_event_free(event);
             event = iax_get_event(0);
             continue;
@@ -153,7 +148,7 @@ IAXVoIPLink::getEvent()
         }
 
         {
-            sfl::ScopedLock lock(mutexIAX_);
+            std::lock_guard<std::mutex> lock(mutexIAX_);
             iax_event_free(event);
             event = iax_get_event(0);
         }
@@ -173,7 +168,7 @@ std::vector<std::string>
 IAXVoIPLink::getCallIDs()
 {
     std::vector<std::string> v;
-    sfl::ScopedLock m(iaxCallMapMutex_);
+    std::lock_guard<std::mutex> lock(iaxCallMapMutex_);
 
     map_utils::vectorFromMapKeys(iaxCallMap_, v);
     return v;
@@ -182,7 +177,7 @@ IAXVoIPLink::getCallIDs()
 void
 IAXVoIPLink::sendAudioFromMic()
 {
-    for (const auto &item : iaxCallMap_) {
+    for (const auto & item : iaxCallMap_) {
         IAXCall *currentCall = static_cast<IAXCall*>(item.second);
 
         if (!currentCall or currentCall->getState() != Call::ACTIVE)
@@ -228,7 +223,7 @@ IAXVoIPLink::sendAudioFromMic()
         compSize = audioCodec->encode(encodedData_, in->getData(), DEC_BUFFER_SIZE);
 
         if (currentCall->session and samples > 0) {
-            sfl::ScopedLock m(mutexIAX_);
+            std::lock_guard<std::mutex> lock(mutexIAX_);
 
             if (iax_send_voice(currentCall->session, currentCall->format, encodedData_, compSize, outSamples) == -1)
                 ERROR("IAX: Error sending voice data.");
@@ -254,7 +249,7 @@ IAXVoIPLink::sendRegister(Account *a)
     if (account->getUsername().empty())
         throw VoipLinkException("Account username is empty");
 
-    sfl::ScopedLock m(mutexIAX_);
+    std::lock_guard<std::mutex> lock(mutexIAX_);
 
     if (regSession_)
         iax_destroy(regSession_);
@@ -272,7 +267,7 @@ void
 IAXVoIPLink::sendUnregister(Account *a)
 {
     if (regSession_) {
-        sfl::ScopedLock m(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         iax_destroy(regSession_);
         regSession_ = NULL;
     }
@@ -305,7 +300,7 @@ IAXVoIPLink::answer(Call *call)
     Manager::instance().addStream(call->getCallId());
 
     {
-        sfl::ScopedLock lock(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         call->answer();
     }
 
@@ -326,7 +321,7 @@ IAXVoIPLink::hangup(const std::string& id, int reason UNUSED)
     Manager::instance().getMainBuffer().unBindAll(call->getCallId());
 
     {
-        sfl::ScopedLock lock(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         iax_hangup(call->session, (char*) "Dumped Call");
     }
 
@@ -364,7 +359,7 @@ IAXVoIPLink::onhold(const std::string& id)
     Manager::instance().getMainBuffer().unBindAll(call->getCallId());
 
     {
-        sfl::ScopedLock lock(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         iax_quelch_moh(call->session, true);
     }
 
@@ -382,7 +377,7 @@ IAXVoIPLink::offhold(const std::string& id)
     Manager::instance().addStream(call->getCallId());
 
     {
-        sfl::ScopedLock lock(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         iax_unquelch(call->session);
     }
 
@@ -398,11 +393,11 @@ IAXVoIPLink::transfer(const std::string& id, const std::string& to)
     if (!call)
         return;
 
-    char callto[to.length() +1];
+    char callto[to.length() + 1];
     strcpy(callto, to.c_str());
 
     {
-        sfl::ScopedLock lock(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         iax_transfer(call->session, callto);
     }
 }
@@ -420,7 +415,7 @@ IAXVoIPLink::refuse(const std::string& id)
 
     if (call) {
         {
-            sfl::ScopedLock lock(mutexIAX_);
+            std::lock_guard<std::mutex> lock(mutexIAX_);
             iax_reject(call->session, (char*) "Call rejected manually.");
         }
 
@@ -435,7 +430,7 @@ IAXVoIPLink::carryingDTMFdigits(const std::string& id, char code)
     IAXCall* call = getIAXCall(id);
 
     if (call) {
-        sfl::ScopedLock lock(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         iax_send_dtmf(call->session, code);
     }
 }
@@ -449,7 +444,7 @@ IAXVoIPLink::sendTextMessage(const std::string& callID,
     IAXCall* call = getIAXCall(callID);
 
     if (call) {
-        sfl::ScopedLock lock(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         sfl::InstantMessaging::send_iax_message(call->session, callID, message.c_str());
     }
 }
@@ -458,9 +453,10 @@ IAXVoIPLink::sendTextMessage(const std::string& callID,
 void
 IAXVoIPLink::clearIaxCallMap()
 {
-    sfl::ScopedLock m(iaxCallMapMutex_);
+    std::lock_guard<std::mutex> lock(iaxCallMapMutex_);
 
-    for (const auto &item : iaxCallMap_)
+
+    for (const auto & item : iaxCallMap_)
         delete item.second;
 
     iaxCallMap_.clear();
@@ -471,7 +467,7 @@ void
 IAXVoIPLink::addIaxCall(IAXCall* call)
 {
     if (call and getIaxCall(call->getCallId()) == NULL) {
-        sfl::ScopedLock m(iaxCallMapMutex_);
+        std::lock_guard<std::mutex> lock(iaxCallMapMutex_);
         iaxCallMap_[call->getCallId()] = call;
     }
 }
@@ -479,7 +475,7 @@ IAXVoIPLink::addIaxCall(IAXCall* call)
 void
 IAXVoIPLink::removeIaxCall(const std::string& id)
 {
-    sfl::ScopedLock m(iaxCallMapMutex_);
+    std::lock_guard<std::mutex> lock(iaxCallMapMutex_);
 
     DEBUG("Removing call %s from list", id.c_str());
 
@@ -517,7 +513,7 @@ IAXVoIPLink::getCurrentAudioCodecNames(Call *c) const
 void
 IAXVoIPLink::iaxOutgoingInvite(IAXCall* call)
 {
-    sfl::ScopedLock m(mutexIAX_);
+    std::lock_guard<std::mutex> lock(mutexIAX_);
 
     call->session = iax_session_new();
 
@@ -537,9 +533,9 @@ IAXVoIPLink::iaxOutgoingInvite(IAXCall* call)
 IAXCall*
 IAXVoIPLink::iaxFindCallBySession(iax_session* session)
 {
-    sfl::ScopedLock m(iaxCallMapMutex_);
+    std::lock_guard<std::mutex> lock(iaxCallMapMutex_);
 
-    for (const auto &item : iaxCallMap_) {
+    for (const auto & item : iaxCallMap_) {
         IAXCall* call = static_cast<IAXCall*>(item.second);
 
         if (call and call->session == session)
@@ -685,7 +681,7 @@ void IAXVoIPLink::iaxHandleRegReply(iax_event* event)
         return;
 
     {
-        sfl::ScopedLock m(mutexIAX_);
+        std::lock_guard<std::mutex> lock(mutexIAX_);
         iax_destroy(regSession_);
         regSession_ = NULL;
     }
@@ -719,6 +715,7 @@ void IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event)
             // if peerNumber exist append it to the name string
             if (event->ies.calling_number)
                 call->initRecFilename(std::string(event->ies.calling_number));
+
             Manager::instance().incomingCall(*call, accountID_);
 
             format = call->getFirstMatchingFormat(event->ies.format, accountID_);
@@ -741,6 +738,7 @@ void IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event)
                 Manager::instance().peerHungupCall(id);
                 removeIaxCall(id);
             }
+
             break;
 
         case IAX_EVENT_TIMEOUT: // timeout for an unknown session
@@ -748,6 +746,7 @@ void IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event)
         case IAX_EVENT_REGACK:
         case IAX_EVENT_REGREJ:
         case IAX_EVENT_REGREQ:
+
             // Received when someone wants to register to us!?!
             // Asterisk receives and answers to that, not us, we're a phone.
         default:
diff --git a/daemon/src/iax/iaxvoiplink.h b/daemon/src/iax/iaxvoiplink.h
index 83463701bc8990875ace96e3e6e774542b7b18d3..d5df328da2eea323e11ffe14b0c9d14e7b3e34dc 100644
--- a/daemon/src/iax/iaxvoiplink.h
+++ b/daemon/src/iax/iaxvoiplink.h
@@ -36,7 +36,7 @@
 #include "config.h"
 #endif
 
-#include <pthread.h>
+#include <mutex>
 #include "account.h"
 #include "voiplink.h"
 #include "audio/audiobuffer.h"
@@ -210,7 +210,7 @@ class IAXVoIPLink : public VoIPLink {
          */
         static AccountMap iaxAccountMap_;
 
-        static pthread_mutex_t iaxCallMapMutex_;
+        static std::mutex iaxCallMapMutex_;
         static IAXCallMap iaxCallMap_;
 
         /*
@@ -284,7 +284,7 @@ class IAXVoIPLink : public VoIPLink {
 
         /** Mutex for iax_ calls, since we're the only one dealing with the incorporated
          * iax_stuff inside this class. */
-        pthread_mutex_t mutexIAX_;
+        std::mutex mutexIAX_;
 
         /** encoder/decoder/resampler buffers */
         AudioBuffer decData_;
diff --git a/daemon/src/scoped_lock.cpp b/daemon/src/scoped_lock.cpp
deleted file mode 100644
index a816f8a98e4ee7f6c1dce8dc2767558b3841539e..0000000000000000000000000000000000000000
--- a/daemon/src/scoped_lock.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Copyright (C) 2012-2013 Savoir-Faire Linux Inc.
- *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#include "scoped_lock.h"
-
-namespace sfl {
-
-ScopedLock::ScopedLock(pthread_mutex_t &mutex) : mutex_(mutex) {
-    pthread_mutex_lock(&mutex_);
-}
-
-ScopedLock::ScopedLock(pthread_mutex_t &mutex, bool &acquired) : mutex_(mutex) {
-    acquired = (pthread_mutex_trylock(&mutex_) == 0);
-}
-
-
-ScopedLock::~ScopedLock() {
-    pthread_mutex_unlock(&mutex_);
-}
-
-}
diff --git a/daemon/src/scoped_lock.h b/daemon/src/scoped_lock.h
deleted file mode 100644
index 318f8a406dc9d1a35edb8c53b0f535af5db49665..0000000000000000000000000000000000000000
--- a/daemon/src/scoped_lock.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Copyright (C) 2012-2013 Savoir-Faire Linux Inc.
- *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#ifndef SCOPED_LOCK_H_
-#define SCOPED_LOCK_H_
-
-#include <pthread.h>
-
-/**
- * @file scoped_lock.h
- * @brief Helper class to allow exception-safe mutex locking/unlocking.
- * Note that the mutex does not belong to this class.
- */
-namespace sfl {
-
-class ScopedLock {
-    public:
-        explicit ScopedLock(pthread_mutex_t &mutex);
-        // acquired will be set to true if the mutex was locked immediately
-        ScopedLock(pthread_mutex_t &mutex, bool &acquired);
-        ~ScopedLock();
-
-    private:
-        pthread_mutex_t &mutex_;
-};
-
-}
-
-#endif  // SCOPED_LOCK_H_
diff --git a/daemon/src/video/socket_pair.cpp b/daemon/src/video/socket_pair.cpp
index 775496e3305e016db9439825b8463d03e5ac3bd6..095806fe6e9c23ac9da29cf853768d8ab8de230d 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 7329aa13bdbe20be36331ee1f61442b825e70e7f..b6b876982529646077707f85808ddc2255c6906e 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_;
diff --git a/daemon/src/video/video_v4l2_list.cpp b/daemon/src/video/video_v4l2_list.cpp
index e7e704a418501f0adf5eaadc79ea309f424b3c93..0c70141ac6cda5cd934a7f62504db118d7be2d55 100644
--- a/daemon/src/video/video_v4l2_list.cpp
+++ b/daemon/src/video/video_v4l2_list.cpp
@@ -37,7 +37,6 @@
 #include <unistd.h>
 
 #include "logger.h"
-#include "scoped_lock.h"
 
 #include <libudev.h>
 #include <cstring>
@@ -58,7 +57,6 @@ namespace sfl_video {
 
 using std::vector;
 using std::string;
-using sfl::ScopedLock;
 
 static int is_v4l2(struct udev_device *dev)
 {
@@ -71,7 +69,6 @@ VideoV4l2ListThread::VideoV4l2ListThread() : devices_(),
     thread_(0), mutex_(), udev_(0),
     udev_mon_(0), probing_(false)
 {
-    pthread_mutex_init(&mutex_, NULL);
     udev_list_entry *devlist;
     udev_enumerate *devenum;
 
@@ -221,8 +218,6 @@ VideoV4l2ListThread::~VideoV4l2ListThread()
         udev_monitor_unref(udev_mon_);
     if (udev_)
         udev_unref(udev_);
-
-    pthread_mutex_destroy(&mutex_);
 }
 
 void VideoV4l2ListThread::run()
@@ -286,7 +281,7 @@ void VideoV4l2ListThread::run()
 
 void VideoV4l2ListThread::delDevice(const string &node)
 {
-    ScopedLock lock(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
 
     const auto itr = std::find_if(devices_.begin(), devices_.end(),
             [&] (const VideoV4l2Device &d) { return d.device == node; });
@@ -299,7 +294,7 @@ void VideoV4l2ListThread::delDevice(const string &node)
 
 bool VideoV4l2ListThread::addDevice(const string &dev)
 {
-    ScopedLock lock(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
 
     int fd = open(dev.c_str(), O_RDWR);
     if (fd == -1)
@@ -317,7 +312,7 @@ bool VideoV4l2ListThread::addDevice(const string &dev)
 vector<string>
 VideoV4l2ListThread::getChannelList(const string &dev)
 {
-    ScopedLock lock(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
     Devices::const_iterator iter(findDevice(dev));
     if (iter != devices_.end())
         return iter->getChannelList();
@@ -328,7 +323,7 @@ VideoV4l2ListThread::getChannelList(const string &dev)
 vector<string>
 VideoV4l2ListThread::getSizeList(const string &dev, const string &channel)
 {
-    ScopedLock lock(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
     Devices::const_iterator iter(findDevice(dev));
     if (iter != devices_.end())
         return iter->getChannel(channel).getSizeList();
@@ -339,7 +334,7 @@ VideoV4l2ListThread::getSizeList(const string &dev, const string &channel)
 vector<string>
 VideoV4l2ListThread::getRateList(const string &dev, const string &channel, const std::string &size)
 {
-    ScopedLock lock(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
     Devices::const_iterator iter(findDevice(dev));
     if (iter != devices_.end())
         return iter->getChannel(channel).getSize(size).getRateList();
@@ -349,7 +344,7 @@ VideoV4l2ListThread::getRateList(const string &dev, const string &channel, const
 
 vector<string> VideoV4l2ListThread::getDeviceList()
 {
-    ScopedLock lock(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
     vector<string> v;
 
     for (const auto &itr : devices_)
@@ -369,7 +364,7 @@ VideoV4l2ListThread::findDevice(const string &name) const
 
 unsigned VideoV4l2ListThread::getChannelNum(const string &dev, const string &name)
 {
-    ScopedLock lock(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
     Devices::const_iterator iter(findDevice(dev));
     if (iter != devices_.end())
         return iter->getChannel(name).idx;
@@ -379,7 +374,7 @@ unsigned VideoV4l2ListThread::getChannelNum(const string &dev, const string &nam
 
 string VideoV4l2ListThread::getDeviceNode(const string &name)
 {
-    ScopedLock lock(mutex_);
+    std::lock_guard<std::mutex> lock(mutex_);
     Devices::const_iterator iter(findDevice(name));
     if (iter != devices_.end())
         return iter->device;
diff --git a/daemon/src/video/video_v4l2_list.h b/daemon/src/video/video_v4l2_list.h
index 0df13fb2c3fa43f45f62ddc606d9c55c6bccdefe..67383517cea803a8bde86f5b818f48e985612bd8 100644
--- a/daemon/src/video/video_v4l2_list.h
+++ b/daemon/src/video/video_v4l2_list.h
@@ -36,6 +36,7 @@
 #include <libudev.h>
 
 #include "video_v4l2.h"
+#include <mutex>
 #include "noncopyable.h"
 
 namespace sfl_video {
@@ -64,7 +65,7 @@ class VideoV4l2ListThread {
         bool addDevice(const std::string &dev);
         std::vector<VideoV4l2Device> devices_;
         pthread_t thread_;
-        pthread_mutex_t mutex_;
+        std::mutex mutex_;
 
         udev *udev_;
         udev_monitor *udev_mon_;