diff --git a/base/src/base/signal/signal.cc b/base/src/base/signal/signal.cc index 51c6192d59..83f2cb2b0e 100644 --- a/base/src/base/signal/signal.cc +++ b/base/src/base/signal/signal.cc @@ -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; } diff --git a/base/src/core/signal_session_component.cc b/base/src/core/signal_session_component.cc index 55c78e7621..a7eb6205e4 100644 --- a/base/src/core/signal_session_component.cc +++ b/base/src/core/signal_session_component.cc @@ -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 diff --git a/base/src/core/signal_source_component.cc b/base/src/core/signal_source_component.cc index 29c6b700ef..f5f05a3e72 100644 --- a/base/src/core/signal_source_component.cc +++ b/base/src/core/signal_source_component.cc @@ -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); }