summaryrefslogtreecommitdiff
path: root/editor/fileserver
diff options
context:
space:
mode:
Diffstat (limited to 'editor/fileserver')
-rw-r--r--editor/fileserver/editor_file_server.cpp11
-rw-r--r--editor/fileserver/editor_file_server.h4
2 files changed, 7 insertions, 8 deletions
diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp
index 02bbeb57c7..d80003a12a 100644
--- a/editor/fileserver/editor_file_server.cpp
+++ b/editor/fileserver/editor_file_server.cpp
@@ -278,7 +278,8 @@ void EditorFileServer::_thread_start(void *s) {
cd->connection = self->server->take_connection();
cd->efs = self;
cd->quit = false;
- cd->thread = Thread::create(_subthread_start, cd);
+ cd->thread = memnew(Thread);
+ cd->thread->start(_subthread_start, cd);
}
}
@@ -287,8 +288,7 @@ void EditorFileServer::_thread_start(void *s) {
Thread *w = self->to_wait.front()->get();
self->to_wait.erase(w);
self->wait_mutex.unlock();
- Thread::wait_to_finish(w);
- memdelete(w);
+ w->wait_to_finish();
self->wait_mutex.lock();
}
self->wait_mutex.unlock();
@@ -317,7 +317,7 @@ EditorFileServer::EditorFileServer() {
quit = false;
active = false;
cmd = CMD_NONE;
- thread = Thread::create(_thread_start, this);
+ thread.start(_thread_start, this);
EDITOR_DEF("filesystem/file_server/port", 6010);
EDITOR_DEF("filesystem/file_server/password", "");
@@ -325,6 +325,5 @@ EditorFileServer::EditorFileServer() {
EditorFileServer::~EditorFileServer() {
quit = true;
- Thread::wait_to_finish(thread);
- memdelete(thread);
+ thread.wait_to_finish();
}
diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h
index 267b129bda..8ffd4f9692 100644
--- a/editor/fileserver/editor_file_server.h
+++ b/editor/fileserver/editor_file_server.h
@@ -47,7 +47,7 @@ class EditorFileServer : public Object {
};
struct ClientData {
- Thread *thread = nullptr;
+ Thread *thread;
Ref<StreamPeerTCP> connection;
Map<int, FileAccess *> files;
EditorFileServer *efs = nullptr;
@@ -61,7 +61,7 @@ class EditorFileServer : public Object {
static void _subthread_start(void *s);
Mutex wait_mutex;
- Thread *thread;
+ Thread thread;
static void _thread_start(void *);
bool quit;
Command cmd;