Merge pull request #46414 from RandomShaper/fix_thread_self_join

Prevent thread wait on itself for finish
This commit is contained in:
Rémi Verschelde 2021-02-25 14:27:20 +01:00 committed by GitHub
commit ba048b8b6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);