Synchronize startup of signal receiver thread

This commit is contained in:
Norman Feske 2012-07-19 19:58:38 +02:00
parent 4454eb03eb
commit b37a28578c

View File

@ -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();
}
};
}