Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SafeFlag for EditorHTTPServer.server_quit #88155

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions platform/web/export/editor_http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

void EditorHTTPServer::_server_thread_poll(void *data) {
EditorHTTPServer *web_server = static_cast<EditorHTTPServer *>(data);
while (!web_server->server_quit.get()) {
while (!web_server->server_quit.is_set()) {
OS::get_singleton()->delay_usec(6900);
{
MutexLock lock(web_server->server_lock);
Expand Down Expand Up @@ -193,7 +193,7 @@ void EditorHTTPServer::_poll() {
}

void EditorHTTPServer::stop() {
server_quit.set(true);
server_quit.set();
if (server_thread.is_started()) {
server_thread.wait_to_finish();
}
Expand Down Expand Up @@ -227,7 +227,7 @@ Error EditorHTTPServer::listen(int p_port, IPAddress p_address, bool p_use_tls,
}
Error err = server->listen(p_port, p_address);
if (err == OK) {
server_quit.set(false);
server_quit.clear();
server_thread.start(_server_thread_poll, this);
}
return err;
Expand Down
2 changes: 1 addition & 1 deletion platform/web/export/editor_http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class EditorHTTPServer : public RefCounted {
uint8_t req_buf[4096];
int req_pos = 0;

SafeNumeric<bool> server_quit;
SafeFlag server_quit;
Mutex server_lock;
Thread server_thread;

Expand Down
Loading