From b37a28578ca107e0fa0085391977d02ec14438af Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 19 Jul 2012 19:58:38 +0200 Subject: [PATCH] Synchronize startup of signal receiver thread --- ports-foc/src/lib/l4lx/genode_block.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ports-foc/src/lib/l4lx/genode_block.cc b/ports-foc/src/lib/l4lx/genode_block.cc index 80df88c4da..bd29d65610 100644 --- a/ports-foc/src/lib/l4lx/genode_block.cc +++ b/ports-foc/src/lib/l4lx/genode_block.cc @@ -129,6 +129,7 @@ namespace { unsigned _count; Block_device **_devs; + Genode::Lock _ready_lock; protected: @@ -144,6 +145,8 @@ namespace { _devs[i]->session()->tx_channel()->sigh_ack_avail(cap); } + _ready_lock.unlock(); + while (true) { Signal s = receiver.wait_for_signal(); for (unsigned i = 0; i < _count; i++) { @@ -160,7 +163,19 @@ namespace { Signal_thread(Block_device **devs) : Genode::Thread<8192>("blk-signal-thread"), - _count(Fiasco::genode_block_count()), _devs(devs) {} + _count(Fiasco::genode_block_count()), _devs(devs), + _ready_lock(Genode::Lock::LOCKED) {} + + void start() + { + Genode::Thread_base::start(); + + /* + * Do not return until the new thread has initialized the + * signal handlers. + */ + _ready_lock.lock(); + } }; }