diff --git a/base/include/base/signal.h b/base/include/base/signal.h index 712a225edf..377688e50c 100644 --- a/base/include/base/signal.h +++ b/base/include/base/signal.h @@ -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 - class Signal_dispatcher : private Signal_dispatcher_base, + class Signal_dispatcher : public Signal_dispatcher_base, public Signal_context_capability { private: diff --git a/base/src/base/signal/signal.cc b/base/src/base/signal/signal.cc index 2b0c889564..e44819d8d8 100644 --- a/base/src/base/signal/signal.cc +++ b/base/src/base/signal/signal.cc @@ -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 ** ************************/