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

@ -250,26 +250,21 @@ namespace Genode {
{
private:
/**
* Lock with the initial state set to LOCKED
*/
struct Barrier : Lock { Barrier() : Lock(Lock::LOCKED) { } };
/**
* Used to block the constructor until the new thread has initialized
* 'id'
*/
Barrier _construct_lock { };
Blockade _construct_lock { };
/**
* Used to block the new thread until 'start' is called
*/
Barrier _start_lock { };
Blockade _start_lock { };
/**
* Used to block the 'join()' function until the 'entry()' is done
*/
Barrier _join_lock { };
Blockade _join_lock { };
public:
@ -278,32 +273,32 @@ namespace Genode {
void wait_for_construction() override
{
_construct_lock.lock();
_construct_lock.block();
}
void constructed() override
{
_construct_lock.unlock();
_construct_lock.wakeup();
}
void wait_for_start() override
{
_start_lock.lock();
_start_lock.block();
}
void started() override
{
_start_lock.unlock();
_start_lock.wakeup();
}
void wait_for_join() override
{
_join_lock.lock();
_join_lock.block();
}
void joined() override
{
_join_lock.unlock();
_join_lock.wakeup();
}
};