Use C++11 std::mutex and std::lock_guard instead of our RAII wrapper.
[cubemap] / accesslog.cpp
index 4a54fdb..2d5eb05 100644 (file)
@@ -7,25 +7,22 @@
 #include "accesslog.h"
 #include "client.h"
 #include "log.h"
-#include "mutexlock.h"
 #include "timespec.h"
 
 using namespace std;
 
 AccessLogThread::AccessLogThread()
 {
-       pthread_mutex_init(&mutex, nullptr);
 }
 
 AccessLogThread::AccessLogThread(const string &filename)
        : filename(filename) {
-       pthread_mutex_init(&mutex, nullptr);
 }
 
 void AccessLogThread::write(const ClientStats& client)
 {
        {
-               MutexLock lock(&mutex);
+               lock_guard<mutex> lock(mu);
                pending_writes.push_back(client);
        }
        wakeup();
@@ -48,7 +45,7 @@ void AccessLogThread::do_work()
                // Empty the queue.
                vector<ClientStats> writes;
                {
-                       MutexLock lock(&mutex);
+                       lock_guard<mutex> lock(mu);
                        swap(pending_writes, writes);
                }