base: support process-local signal submission

Issue #3923
This commit is contained in:
Christian Prochaska 2020-10-26 15:16:03 +01:00 committed by Christian Helmuth
parent 50e0f3b977
commit 798beab30e
4 changed files with 30 additions and 3 deletions

View File

@ -34,3 +34,13 @@ void Signal_transmitter::submit(unsigned cnt)
}
Kernel::submit_signal(Capability_space::capid(_context), cnt);
}
/********************
** Signal_context **
********************/
void Signal_context::local_submit()
{
Kernel::submit_signal(Capability_space::capid(_cap), 1);
}

View File

@ -260,6 +260,8 @@ class Genode::Signal_context : Interface, Noncopyable
List_element<Signal_context> *deferred_le() { return &_deferred_le; }
void local_submit();
/*
* Signal contexts are never invoked but only used as arguments for
* 'Signal_session' methods. Hence, there exists a capability

View File

@ -115,6 +115,7 @@ _ZN6Genode14Rpc_entrypointC1EPNS_10Pd_sessionEmPKcNS_8Affinity8LocationE T
_ZN6Genode14Rpc_entrypointD0Ev T
_ZN6Genode14Rpc_entrypointD1Ev T
_ZN6Genode14Rpc_entrypointD2Ev T
_ZN6Genode14Signal_context12local_submitEv T
_ZN6Genode14Signal_contextD0Ev T
_ZN6Genode14Signal_contextD1Ev T
_ZN6Genode14Signal_contextD2Ev T

View File

@ -110,6 +110,20 @@ namespace Genode {
}
/********************
** Signal_context **
********************/
void Signal_context::local_submit()
{
if (_receiver) {
/* construct and locally submit signal object */
Signal::Data signal(this, 1);
_receiver->local_submit(signal);
}
}
/*****************************
** Signal context registry **
*****************************/
@ -278,16 +292,16 @@ void Signal_receiver::unblock_signal_waiter(Rpc_entrypoint &)
}
void Signal_receiver::local_submit(Signal::Data ns)
void Signal_receiver::local_submit(Signal::Data data)
{
Signal_context *context = ns.context;
Signal_context *context = data.context;
/*
* Replace current signal of the context by signal with accumulated
* counters. In the common case, the current signal is an invalid
* signal with a counter value of zero.
*/
unsigned num = context->_curr_signal.num + ns.num;
unsigned num = context->_curr_signal.num + data.num;
context->_curr_signal = Signal::Data(context, num);
/* wake up the receiver if the context becomes pending */