Prevent thread wait on itself for finish
(cherry picked from commit afc5af8dfa
)
This commit is contained in:
parent
f0fc338858
commit
ef129acedd
1 changed files with 1 additions and 0 deletions
|
@ -92,6 +92,7 @@ bool Thread::is_started() const {
|
||||||
|
|
||||||
void Thread::wait_to_finish() {
|
void Thread::wait_to_finish() {
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
|
ERR_FAIL_COND_MSG(id == get_caller_id(), "A Thread can't wait for itself to finish.");
|
||||||
thread.join();
|
thread.join();
|
||||||
std::thread empty_thread;
|
std::thread empty_thread;
|
||||||
thread.swap(empty_thread);
|
thread.swap(empty_thread);
|
||||||
|
|
Loading…
Reference in a new issue