diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2023-11-21 15:44:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-21 15:44:18 +0100 |
commit | c2f8fb301537a5d688d201178985963282b4f9c3 (patch) | |
tree | 6e21f7954af3ef36854f53830519c6b6be8c689f /core/os/thread.cpp | |
parent | fa259a77cd9ea725f22ccfd52d5c228e10358e1d (diff) | |
parent | fe4850c0d0e8eed3fe851007c667206684aab0fc (diff) | |
download | redot-engine-c2f8fb301537a5d688d201178985963282b4f9c3.tar.gz |
Merge pull request #85039 from RandomShaper/mingwthreads
Use mingw-std-threads in MinGW builds
Diffstat (limited to 'core/os/thread.cpp')
-rw-r--r-- | core/os/thread.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/os/thread.cpp b/core/os/thread.cpp index 03e2c5409d..2ba90ba42c 100644 --- a/core/os/thread.cpp +++ b/core/os/thread.cpp @@ -69,8 +69,7 @@ void Thread::callback(ID p_caller_id, const Settings &p_settings, Callback p_cal Thread::ID Thread::start(Thread::Callback p_callback, void *p_user, const Settings &p_settings) { ERR_FAIL_COND_V_MSG(id != UNASSIGNED_ID, UNASSIGNED_ID, "A Thread object has been re-started without wait_to_finish() having been called on it."); id = id_counter.increment(); - std::thread new_thread(&Thread::callback, id, p_settings, p_callback, p_user); - thread.swap(new_thread); + thread = THREADING_NAMESPACE::thread(&Thread::callback, id, p_settings, p_callback, p_user); return id; } @@ -82,8 +81,7 @@ void Thread::wait_to_finish() { ERR_FAIL_COND_MSG(id == UNASSIGNED_ID, "Attempt of waiting to finish on a thread that was never started."); ERR_FAIL_COND_MSG(id == get_caller_id(), "Threads can't wait to finish on themselves, another thread must wait."); thread.join(); - std::thread empty_thread; - thread.swap(empty_thread); + thread = THREADING_NAMESPACE::thread(); id = UNASSIGNED_ID; } |