1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 19:18:11 +00:00
serenity/Ports/cmake/patches/0024-shared-mutex.patch
AnotherTest 80d6f46d4e Ports: Add a cmake port
Yes, you build this *inside* serenity.
2021-02-15 17:32:56 +01:00

85 lines
2.5 KiB
Diff

diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 7f97406..bebb100 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -251,7 +251,9 @@ cmFileMonitor* cmServer::FileMonitor() const
void cmServer::WriteJsonObject(const Json::Value& jsonValue,
const DebugInfo* debug) const
{
+#if 0
cm::shared_lock<cm::shared_mutex> lock(ConnectionsMutex);
+#endif
for (auto& connection : this->Connections) {
WriteJsonObject(connection.get(), jsonValue, debug);
}
@@ -458,7 +460,9 @@ bool cmServerBase::Serve(std::string* errorMessage)
OnServeStart();
{
+#if 0
cm::shared_lock<cm::shared_mutex> lock(ConnectionsMutex);
+#endif
for (auto& connection : Connections) {
if (!connection->OnServeStart(errorMessage)) {
return false;
@@ -494,7 +498,9 @@ void cmServerBase::StartShutDown()
SIGHUPHandler.reset();
{
+#if 0
std::unique_lock<cm::shared_mutex> lock(ConnectionsMutex);
+#endif
for (auto& connection : Connections) {
connection->OnConnectionShuttingDown();
}
@@ -541,7 +547,9 @@ cmServerBase::~cmServerBase()
void cmServerBase::AddNewConnection(cmConnection* ownedConnection)
{
{
+#if 0
std::unique_lock<cm::shared_mutex> lock(ConnectionsMutex);
+#endif
Connections.emplace_back(ownedConnection);
}
ownedConnection->SetServer(this);
@@ -558,7 +566,9 @@ void cmServerBase::OnDisconnect(cmConnection* pConnection)
return m.get() == pConnection;
};
{
+#if 0
std::unique_lock<cm::shared_mutex> lock(ConnectionsMutex);
+#endif
Connections.erase(
std::remove_if(Connections.begin(), Connections.end(), pred),
Connections.end());
diff --git a/Source/cmServer.h b/Source/cmServer.h
index 9543329..6a19be7 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -65,7 +65,9 @@ public:
void OnDisconnect(cmConnection* pConnection);
protected:
+#if 0
mutable cm::shared_mutex ConnectionsMutex;
+#endif
std::vector<std::unique_ptr<cmConnection>> Connections;
bool ServeThreadRunning = false;
diff --git a/Utilities/std/cm/shared_mutex b/Utilities/std/cm/shared_mutex
index a1204fa..d4812c8 100644
--- a/Utilities/std/cm/shared_mutex
+++ b/Utilities/std/cm/shared_mutex
@@ -5,6 +5,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
+#if 0
#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
# define CMake_HAVE_CXX_SHARED_LOCK
#endif
@@ -71,3 +72,4 @@ public:
};
#endif
}
+#endif