mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Merge pull request #12849 from unknownbrackets/debugger
http: Fix thread join on enable/disable
This commit is contained in:
commit
b5a0af635f
@ -37,6 +37,7 @@ enum class ServerStatus {
|
||||
STARTING,
|
||||
RUNNING,
|
||||
STOPPING,
|
||||
FINISHED,
|
||||
};
|
||||
|
||||
static const char *REPORT_HOSTNAME = "report.ppsspp.org";
|
||||
@ -248,7 +249,7 @@ static void ExecuteWebServer() {
|
||||
if (!http->Listen(g_Config.iRemoteISOPort)) {
|
||||
if (!http->Listen(0)) {
|
||||
ERROR_LOG(FILESYS, "Unable to listen on any port");
|
||||
UpdateStatus(ServerStatus::STOPPED);
|
||||
UpdateStatus(ServerStatus::FINISHED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -271,7 +272,7 @@ static void ExecuteWebServer() {
|
||||
StopAllDebuggers();
|
||||
delete http;
|
||||
|
||||
UpdateStatus(ServerStatus::STOPPED);
|
||||
UpdateStatus(ServerStatus::FINISHED);
|
||||
}
|
||||
|
||||
bool StartWebServer(WebServerFlags flags) {
|
||||
@ -284,6 +285,9 @@ bool StartWebServer(WebServerFlags flags) {
|
||||
serverFlags |= (int)flags;
|
||||
return true;
|
||||
|
||||
case ServerStatus::FINISHED:
|
||||
serverThread.join();
|
||||
// Intentional fallthrough.
|
||||
case ServerStatus::STOPPED:
|
||||
serverStatus = ServerStatus::STARTING;
|
||||
serverFlags = (int)flags;
|
||||
@ -318,11 +322,13 @@ bool WebServerStopped(WebServerFlags flags) {
|
||||
if (serverStatus == ServerStatus::RUNNING) {
|
||||
return (serverFlags & (int)flags) == 0;
|
||||
}
|
||||
return serverStatus == ServerStatus::STOPPED;
|
||||
return serverStatus == ServerStatus::STOPPED || serverStatus == ServerStatus::FINISHED;
|
||||
}
|
||||
|
||||
void ShutdownWebServer() {
|
||||
StopWebServer(WebServerFlags::ALL);
|
||||
if (serverThread.joinable())
|
||||
|
||||
if (serverStatus != ServerStatus::STOPPED)
|
||||
serverThread.join();
|
||||
serverStatus = ServerStatus::STOPPED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user