If a newly started thread immediately exits then m_running would
immediately be set to false again and the caller would be stuck
waiting for m_running to become true forever.
Since a mutex for synchronizing startup already exists we can
simply move the while loop into it.
see also: #5134 which introduced m_start_finished_mutex
return false;
}
- // Allow spawned thread to continue
- m_start_finished_mutex.unlock();
-
while (!m_running)
sleep_ms(1);
+ // Allow spawned thread to continue
+ m_start_finished_mutex.unlock();
+
m_joinable = true;
return true;