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

@ -19,9 +19,9 @@ enum { STACK_SIZE = 4096 };
struct Thread : Genode::Thread_deprecated<STACK_SIZE>
{
Genode::Lock &_barrier;
Genode::Blockade &_barrier;
Thread(Genode::Lock &barrier)
Thread(Genode::Blockade &barrier)
: Genode::Thread_deprecated<STACK_SIZE>("stat"), _barrier(barrier) { start(); }
void entry() override
@ -37,7 +37,7 @@ struct Thread : Genode::Thread_deprecated<STACK_SIZE>
/*
* Let main thread procees
*/
_barrier.unlock();
_barrier.wakeup();
}
};
@ -55,7 +55,7 @@ void Component::construct(Genode::Env &env)
{
Genode::log("--- thread-local errno test ---");
static Genode::Lock barrier(Genode::Lock::LOCKED);
static Genode::Blockade barrier;
int const orig_errno = errno;
@ -65,7 +65,7 @@ void Component::construct(Genode::Env &env)
static Thread thread(barrier);
/* block until the thread performed a 'stat' syscall */
barrier.lock();
barrier.block();
Genode::log("main: after thread completed, errno=", errno);

View File

@ -24,9 +24,9 @@
static Genode::Lock *main_wait_lock()
static Genode::Blockade *main_wait_lock()
{
static Genode::Lock inst(Genode::Lock::LOCKED);
static Genode::Blockade inst;
return &inst;
}
@ -46,7 +46,7 @@ static void *pthread_entry(void *)
Genode::log("second message");
main_wait_lock()->unlock();
main_wait_lock()->wakeup();
return 0;
}
@ -67,7 +67,7 @@ void Component::construct(Genode::Env &env)
pthread_create(&pth, 0, pthread_entry, 0);
/* wait until 'pthread_entry' finished */
main_wait_lock()->lock();
main_wait_lock()->block();
Genode::log("--- finished pthread IPC test ---");
exit_status = 0;