diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-02-25 14:27:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-25 14:27:20 +0100 |
commit | ba048b8b6ef1709d50c12201c513df50917098ce (patch) | |
tree | d6b35df4bd606d8f95746bac823be9cc2da654b9 | |
parent | a61fbe3b3289d346b0910486de7b6b1a9bf7a36e (diff) | |
parent | afc5af8dfa7dd3076c7d6a347d96c81d82be88fe (diff) |
Merge pull request #46414 from RandomShaper/fix_thread_self_join
Prevent thread wait on itself for finish
-rw-r--r-- | core/os/thread.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/os/thread.cpp b/core/os/thread.cpp index 88744eed63..aea370787d 100644 --- a/core/os/thread.cpp +++ b/core/os/thread.cpp @@ -92,6 +92,7 @@ bool Thread::is_started() const { void Thread::wait_to_finish() { if (id != 0) { + ERR_FAIL_COND_MSG(id == get_caller_id(), "A Thread can't wait for itself to finish."); thread.join(); std::thread empty_thread; thread.swap(empty_thread); |