base: Local signal submit

This commit is contained in:
Sebastian Sumpf 2013-10-18 12:08:44 +02:00 committed by Norman Feske
parent 50d73e7890
commit 864a047206
2 changed files with 36 additions and 1 deletions

View File

@ -170,6 +170,16 @@ namespace Genode {
*/
virtual ~Signal_context() { }
/**
* Local sginal submission (DEPRECATED)
*
* Trigger local signal submission (within the same address space), the
* context has to be bound to a sginal receiver beforehand.
*
* \param num number of pending signals
*/
void submit(unsigned num);
/*
* Signal contexts are never invoked but only used as arguments for
* 'Signal_session' functions. Hence, there exists a capability
@ -343,7 +353,7 @@ namespace Genode {
* \param T type of signal-handling class
*/
template <typename T>
class Signal_dispatcher : private Signal_dispatcher_base,
class Signal_dispatcher : public Signal_dispatcher_base,
public Signal_context_capability
{
private:

View File

@ -199,6 +199,31 @@ Signal::Signal(Signal::Data data) : _data(data)
}
/********************
** Signal context **
********************/
void Signal_context::submit(unsigned num)
{
if (!_receiver) {
PWRN("signal context with no receiver");
return;
}
if (!signal_context_registry()->test_and_lock(this)) {
PWRN("encountered dead signal context");
return;
}
/* construct and locally submit signal object */
Signal::Data signal(this, num);
_receiver->local_submit(signal);
/* free context lock that was taken by 'test_and_lock' */
_lock.unlock();
}
/************************
** Signal transmitter **
************************/