Signal accounting in the explicit-reply path

Properly account signal count in the explicit-reply path (when source-
client gets immediately unblocked by 'signal_session_component::submit').
This patch prevents the delivery of superfluous signals with num == 0.
This commit is contained in:
Norman Feske 2011-12-22 17:20:45 +01:00 committed by Christian Helmuth
parent defd6a9b58
commit 3d5cfde313
3 changed files with 17 additions and 11 deletions

View File

@ -241,6 +241,9 @@ Signal Signal_receiver::wait_for_signal()
/* invalidate current signal in context */
context->_curr_signal = Signal(0, 0);
if (result.num() == 0)
PWRN("returning signal with num == 0");
/* return last received signal */
return result;
}

View File

@ -86,7 +86,7 @@ void Signal_session_component::free_context(Signal_context_capability context_ca
void Signal_session_component::submit(Signal_context_capability context_cap,
unsigned cnt)
unsigned cnt)
{
Signal_context_component *context;
context = dynamic_cast<Signal_context_component *>

View File

@ -29,6 +29,13 @@ void Signal_source_component::submit(Signal_context_component *context,
Ipc_ostream *ostream,
int cnt)
{
/*
* If the client does not block in 'wait_for_signal', the
* signal will be delivered as result of the next
* 'wait_for_signal' call.
*/
context->increment_signal_cnt(cnt);
/*
* If the client is blocking at the signal source (indicated by
* the valid reply capability), we wake him up.
@ -43,17 +50,13 @@ void Signal_source_component::submit(Signal_context_component *context,
* the reply capability.
*/
_reply_cap = Untyped_capability();
context->reset_signal_cnt();
} else {
if (!context->is_enqueued())
_signal_queue.enqueue(context);
}
/*
* If the client does not block in 'wait_for_signal', the
* signal will be delivered as result of the next
* 'wait_for_signal' call.
*/
context->increment_signal_cnt(cnt);
if (!context->is_enqueued())
_signal_queue.enqueue(context);
}