diff options
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; } |