core: use Mutex/Blockade

Issue #3612
This commit is contained in:
Alexander Boettcher
2020-02-18 15:29:47 +01:00
committed by Christian Helmuth
parent 85a1f91f59
commit e87d60ddf7
48 changed files with 218 additions and 232 deletions

View File

@ -36,10 +36,10 @@ extern int main_thread_futex_counter;
static void empty_signal_handler(int) { }
static Lock &startup_lock()
static Blockade &startup_lock()
{
static Lock lock(Lock::LOCKED);
return lock;
static Blockade blockade;
return blockade;
}
@ -75,7 +75,7 @@ void Thread::_thread_start()
}
/* wakeup 'start' function */
startup_lock().unlock();
startup_lock().wakeup();
thread->entry();
@ -140,8 +140,8 @@ void Thread::_deinit_platform_thread()
void Thread::start()
{
/* synchronize calls of the 'start' function */
static Lock lock;
Lock::Guard guard(lock);
static Mutex mutex;
Mutex::Guard guard(mutex);
_init_cpu_session_and_trace_control();
@ -161,7 +161,7 @@ void Thread::start()
native_thread().pid = lx_getpid();
/* wait until the 'thread_start' function got entered */
startup_lock().lock();
startup_lock().block();
}