瀏覽代碼

Prevent thread wait on itself for finish

(cherry picked from commit afc5af8dfa7dd3076c7d6a347d96c81d82be88fe)
Pedro J. Estébanez 4 年之前
父節點
當前提交
ef129acedd
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      core/os/thread.cpp

+ 1 - 0
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);