diff --git a/repos/base-fiasco/src/core/thread_start.cc b/repos/base-fiasco/src/core/thread_start.cc index 53eebe162d..13ee042645 100644 --- a/repos/base-fiasco/src/core/thread_start.cc +++ b/repos/base-fiasco/src/core/thread_start.cc @@ -29,7 +29,7 @@ void Thread::_thread_start() { Thread::myself()->_thread_bootstrap(); Thread::myself()->entry(); - Thread::myself()->_join_lock.unlock(); + Thread::myself()->_join.wakeup(); sleep_forever(); } diff --git a/repos/base-foc/src/lib/base/thread_bootstrap.cc b/repos/base-foc/src/lib/base/thread_bootstrap.cc index 19b94367c0..7035467efe 100644 --- a/repos/base-foc/src/lib/base/thread_bootstrap.cc +++ b/repos/base-foc/src/lib/base/thread_bootstrap.cc @@ -59,6 +59,6 @@ void Genode::Thread::_thread_start() Thread::myself()->_thread_bootstrap(); Thread::myself()->entry(); - Thread::myself()->_join_lock.unlock(); + Thread::myself()->_join.wakeup(); sleep_forever(); } diff --git a/repos/base-hw/src/lib/base/thread_bootstrap.cc b/repos/base-hw/src/lib/base/thread_bootstrap.cc index 506ae2231d..48e0754f4a 100644 --- a/repos/base-hw/src/lib/base/thread_bootstrap.cc +++ b/repos/base-hw/src/lib/base/thread_bootstrap.cc @@ -75,7 +75,7 @@ void Thread::_thread_start() { Thread::myself()->_thread_bootstrap(); Thread::myself()->entry(); - Thread::myself()->_join_lock.unlock(); + Thread::myself()->_join.wakeup(); Genode::sleep_forever(); } diff --git a/repos/base-linux/src/core/thread_linux.cc b/repos/base-linux/src/core/thread_linux.cc index b272a0ac0a..0b36d43b21 100644 --- a/repos/base-linux/src/core/thread_linux.cc +++ b/repos/base-linux/src/core/thread_linux.cc @@ -53,7 +53,7 @@ void Thread::_thread_start() lx_sigsetmask(LX_SIGCHLD, false); Thread::myself()->entry(); - Thread::myself()->_join_lock.unlock(); + Thread::myself()->_join.wakeup(); sleep_forever(); } diff --git a/repos/base-linux/src/lib/base/thread_linux.cc b/repos/base-linux/src/lib/base/thread_linux.cc index 0d3e9a41d1..8c682bc8a1 100644 --- a/repos/base-linux/src/lib/base/thread_linux.cc +++ b/repos/base-linux/src/lib/base/thread_linux.cc @@ -80,7 +80,7 @@ void Thread::_thread_start() thread->entry(); /* unblock caller of 'join()' */ - thread->_join_lock.unlock(); + thread->_join.wakeup(); sleep_forever(); } diff --git a/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc b/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc index 085f437663..6cfe12fad3 100644 --- a/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc +++ b/repos/base-linux/src/lib/lx_hybrid/lx_hybrid.cc @@ -496,7 +496,7 @@ Native_thread &Thread::native_thread() { return *_native_thread; } Thread::Thread(size_t weight, const char *name, size_t /* stack size */, Type, Cpu_session * cpu_sess, Affinity::Location) -: _cpu_session(cpu_sess), _affinity(), _join_lock() +: _cpu_session(cpu_sess), _affinity() { Native_thread::Meta_data *meta_data = new (global_alloc()) Thread_meta_data_created(this); diff --git a/repos/base-nova/src/lib/base/thread_start.cc b/repos/base-nova/src/lib/base/thread_start.cc index fa42b0b6bd..eb41a4179e 100644 --- a/repos/base-nova/src/lib/base/thread_start.cc +++ b/repos/base-nova/src/lib/base/thread_start.cc @@ -59,7 +59,7 @@ void Thread::_thread_start() throw; } - Thread::myself()->_join_lock.unlock(); + Thread::myself()->_join.wakeup(); /* sleep silently */ Genode::sleep_forever(); diff --git a/repos/base-okl4/src/core/thread_start.cc b/repos/base-okl4/src/core/thread_start.cc index 6567188e08..dd2ebbc65a 100644 --- a/repos/base-okl4/src/core/thread_start.cc +++ b/repos/base-okl4/src/core/thread_start.cc @@ -29,7 +29,7 @@ void Thread::_thread_start() { Thread::myself()->_thread_bootstrap(); Thread::myself()->entry(); - Thread::myself()->_join_lock.unlock(); + Thread::myself()->_join.wakeup(); sleep_forever(); } diff --git a/repos/base-pistachio/src/core/thread_start.cc b/repos/base-pistachio/src/core/thread_start.cc index 53eebe162d..13ee042645 100644 --- a/repos/base-pistachio/src/core/thread_start.cc +++ b/repos/base-pistachio/src/core/thread_start.cc @@ -29,7 +29,7 @@ void Thread::_thread_start() { Thread::myself()->_thread_bootstrap(); Thread::myself()->entry(); - Thread::myself()->_join_lock.unlock(); + Thread::myself()->_join.wakeup(); sleep_forever(); } diff --git a/repos/base/include/base/thread.h b/repos/base/include/base/thread.h index a4b408d9a7..c8cda8f2b2 100644 --- a/repos/base/include/base/thread.h +++ b/repos/base/include/base/thread.h @@ -16,7 +16,7 @@ /* Genode includes */ #include -#include +#include #include #include #include @@ -129,9 +129,9 @@ class Genode::Thread Native_thread *_native_thread = nullptr; /** - * Lock used for synchronizing the finalization of the thread + * Blockade used for synchronizing the finalization of the thread */ - Lock _join_lock; + Blockade _join { }; /** * Thread type diff --git a/repos/base/src/lib/base/thread.cc b/repos/base/src/lib/base/thread.cc index 769ce2421d..f089d478f9 100644 --- a/repos/base/src/lib/base/thread.cc +++ b/repos/base/src/lib/base/thread.cc @@ -140,7 +140,7 @@ void Thread::name(char *dst, size_t dst_len) Thread::Name Thread::name() const { return _stack->name(); } -void Thread::join() { _join_lock.lock(); } +void Thread::join() { _join.block(); } void *Thread::alloc_secondary_stack(char const *name, size_t stack_size) @@ -204,8 +204,7 @@ Thread::Thread(size_t weight, const char *name, size_t stack_size, _affinity(affinity), _trace_control(nullptr), _stack(type == REINITIALIZED_MAIN ? - _stack : _alloc_stack(stack_size, name, type == MAIN)), - _join_lock(Lock::LOCKED) + _stack : _alloc_stack(stack_size, name, type == MAIN)) { _init_platform_thread(weight, type); } diff --git a/repos/base/src/lib/base/thread_start.cc b/repos/base/src/lib/base/thread_start.cc index 7d60fae59a..63ccd88375 100644 --- a/repos/base/src/lib/base/thread_start.cc +++ b/repos/base/src/lib/base/thread_start.cc @@ -46,7 +46,7 @@ void Thread::_thread_start() throw; } - Thread::myself()->_join_lock.unlock(); + Thread::myself()->_join.wakeup(); /* sleep silently */ Genode::sleep_forever();