summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmServer.cxx7
-rw-r--r--Source/cmUVHandlePtr.cxx10
-rw-r--r--Source/cm_thread.hxx40
3 files changed, 9 insertions, 48 deletions
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index ac42fde..1b04ca2 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -18,6 +18,7 @@
#include <cstdint>
#include <iostream>
#include <memory>
+#include <mutex>
#include <utility>
void on_signal(uv_signal_t* signal, int signum)
@@ -490,7 +491,7 @@ void cmServerBase::StartShutDown()
SIGHUPHandler.reset();
{
- cm::unique_lock<cm::shared_mutex> lock(ConnectionsMutex);
+ std::unique_lock<cm::shared_mutex> lock(ConnectionsMutex);
for (auto& connection : Connections) {
connection->OnConnectionShuttingDown();
}
@@ -537,7 +538,7 @@ cmServerBase::~cmServerBase()
void cmServerBase::AddNewConnection(cmConnection* ownedConnection)
{
{
- cm::unique_lock<cm::shared_mutex> lock(ConnectionsMutex);
+ std::unique_lock<cm::shared_mutex> lock(ConnectionsMutex);
Connections.emplace_back(ownedConnection);
}
ownedConnection->SetServer(this);
@@ -554,7 +555,7 @@ void cmServerBase::OnDisconnect(cmConnection* pConnection)
return m.get() == pConnection;
};
{
- cm::unique_lock<cm::shared_mutex> lock(ConnectionsMutex);
+ std::unique_lock<cm::shared_mutex> lock(ConnectionsMutex);
Connections.erase(
std::remove_if(Connections.begin(), Connections.end(), pred),
Connections.end());
diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx
index d7e38c3..eb70416 100644
--- a/Source/cmUVHandlePtr.cxx
+++ b/Source/cmUVHandlePtr.cxx
@@ -4,9 +4,9 @@
#include "cmUVHandlePtr.h"
#include <assert.h>
+#include <mutex>
#include <stdlib.h>
-#include "cm_thread.hxx"
#include "cm_uv.h"
namespace cm {
@@ -97,16 +97,16 @@ struct uv_handle_deleter<uv_async_t>
* which is mandated by the standard for Deleter on
* shared_ptrs.
*/
- std::shared_ptr<cm::mutex> handleMutex;
+ std::shared_ptr<std::mutex> handleMutex;
uv_handle_deleter()
- : handleMutex(std::make_shared<cm::mutex>())
+ : handleMutex(std::make_shared<std::mutex>())
{
}
void operator()(uv_async_t* handle)
{
- cm::lock_guard<cm::mutex> lock(*handleMutex);
+ std::lock_guard<std::mutex> lock(*handleMutex);
default_delete(handle);
}
};
@@ -116,7 +116,7 @@ void uv_async_ptr::send()
auto deleter = std::get_deleter<uv_handle_deleter<uv_async_t>>(this->handle);
assert(deleter);
- cm::lock_guard<cm::mutex> lock(*deleter->handleMutex);
+ std::lock_guard<std::mutex> lock(*deleter->handleMutex);
if (this->handle) {
uv_async_send(*this);
}
diff --git a/Source/cm_thread.hxx b/Source/cm_thread.hxx
index ec5fe1d..84e6a5c 100644
--- a/Source/cm_thread.hxx
+++ b/Source/cm_thread.hxx
@@ -7,34 +7,6 @@
#include "cm_uv.h"
namespace cm {
-class mutex
-{
- CM_DISABLE_COPY(mutex)
- uv_mutex_t _M_;
-
-public:
- mutex() { uv_mutex_init(&_M_); }
- ~mutex() { uv_mutex_destroy(&_M_); }
-
- void lock() { uv_mutex_lock(&_M_); }
-
- void unlock() { uv_mutex_unlock(&_M_); }
-};
-
-template <typename T>
-class lock_guard
-{
- T& _mutex;
- CM_DISABLE_COPY(lock_guard)
-
-public:
- lock_guard(T& m)
- : _mutex(m)
- {
- _mutex.lock();
- }
- ~lock_guard() { _mutex.unlock(); }
-};
class shared_mutex
{
@@ -68,17 +40,5 @@ public:
}
~shared_lock() { _mutex.unlock_shared(); }
};
-
-template <typename T>
-class unique_lock : public lock_guard<T>
-{
- CM_DISABLE_COPY(unique_lock)
-
-public:
- unique_lock(T& m)
- : lock_guard<T>(m)
- {
- }
-};
}
#endif