Skip to content

Commit 74c169e

Browse files
committed
Improved thread locks on Windows
Changed server thread locks to improve multithreading - work still to do though. This is mostly MMF2Exts fixes; bluewing-cpp-server doesn't have UI so it doesn't need a separate processing thread as MMF2Exts uses it. However, it can have two writer threads, due to the ping timer thread. The new lock system has separate locks for server client list, server channel list, server udp and a meta lock (for host/unhost, welcome message change, handler change). Amended SSL client struct type, as well. This should be official server build 34.
1 parent 6f0cd1d commit 74c169e

File tree

8 files changed

+124
-77
lines changed

8 files changed

+124
-77
lines changed

Lacewing/Lacewing.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,14 @@ struct relayserver
21412141
// Expects you have already checked channel with that name does not exist.
21422142
std::shared_ptr<relayserver::channel> createchannel(std::string_view channelName, std::shared_ptr<lacewing::relayserver::client> master, bool hidden, bool autoclose);
21432143

2144-
mutable lacewing::readwritelock lock;
2144+
// handles unhost/host, welcome message change, handler change
2145+
mutable lacewing::readwritelock lock_meta;
2146+
// handles channel list modifications - only to the underlying vector, not to requests like leave or close requests
2147+
mutable lacewing::readwritelock lock_channellist;
2148+
// handles client list modifications - only to the underlying vector, not to requests like disconnect requests
2149+
mutable lacewing::readwritelock lock_clientlist;
2150+
// handles UDP?
2151+
mutable lacewing::readwritelock lock_udp;
21452152

21462153
typedef void(*handler_connect) (lacewing::relayserver &server, std::shared_ptr<lacewing::relayserver::client> client);
21472154
typedef void(*handler_disconnect) (lacewing::relayserver &server, std::shared_ptr<lacewing::relayserver::client> client);

Lacewing/PhiAddress.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ void LacewingFatalErrorMsgBox2(const char * const func, const char * const file,
319319
err << "Lacewing fatal error detected.\nFile: "sv << fileSub << "\nFunction: "sv << func << "\nLine: "sv << line;
320320
#ifdef _WIN32
321321
MessageBoxA(NULL, err.str().c_str(), "" PROJECT_NAME " fatal error", MB_ICONERROR);
322+
std::abort();
322323
#else
323324
char output[512];
324325
strcpy(output, err.str().c_str());

0 commit comments

Comments
 (0)