Signal_handler: remove num argument from handler

We will eventually remove the delivery of the number of occurred signals
to the recipient. There haven't been any convincing use cases for this
feature. In the contrary, it actually led to wrong design choices in the
past where the rate of signals carried information (such as the progress
of time) that should better be obtained via an explicit RPC call.

The old 'Signal_rpc_member' template retains the old interface for now.
But the new 'Signal_handler' omits the 'unsigned' argument from the
handler function.
This commit is contained in:
Norman Feske 2016-04-20 23:22:12 +02:00 committed by Christian Helmuth
parent 861508ad68
commit 73b463cdbb
3 changed files with 49 additions and 15 deletions

View File

@ -85,7 +85,7 @@ class Genode::Entrypoint : Genode::Noncopyable
* let the signal-dispatching thread execute the actual suspend-
* resume mechanism.
*/
void _handle_suspend(unsigned) { }
void _handle_suspend() { }
Lazy_volatile_object<Genode::Signal_handler<Entrypoint>> _suspend_dispatcher;
void _dispatch_signal(Signal &sig);

View File

@ -438,12 +438,10 @@ class Genode::Signal_dispatcher : public Signal_dispatcher_base,
/**
* Signal dispatcher for handling signals by an object method
*
* This utility associates object methods with signals. It is intended to
* This utility associates an object method with signals. It is intended to
* be used as a member variable of the class that handles incoming signals
* of a certain type. The constructor takes a pointer-to-member to the
* signal-handling method as argument. If a signal is received at the
* common signal reception code, this method will be invoked by calling
* 'Signal_dispatcher_base::dispatch'.
* signal-handling method as argument.
*
* \param T type of signal-handling class
* \param EP type of entrypoint handling signal RPC
@ -454,7 +452,7 @@ struct Genode::Signal_handler : Genode::Signal_dispatcher_base,
{
EP &ep;
T &obj;
void (T::*member) (unsigned);
void (T::*member) ();
/**
* Constructor
@ -463,7 +461,7 @@ struct Genode::Signal_handler : Genode::Signal_dispatcher_base,
* \param obj,member object and method to call when
* the signal occurs
*/
Signal_handler(EP &ep, T &obj, void (T::*member)(unsigned))
Signal_handler(EP &ep, T &obj, void (T::*member)())
: Signal_context_capability(ep.manage(*this)),
ep(ep), obj(obj), member(member) { }
@ -472,7 +470,7 @@ struct Genode::Signal_handler : Genode::Signal_dispatcher_base,
/**
* Interface of Signal_dispatcher_base
*/
void dispatch(unsigned num) { (obj.*member)(num); }
void dispatch(unsigned num) { (obj.*member)(); }
};
#endif /* _INCLUDE__BASE__SIGNAL_H_ */

View File

@ -20,14 +20,50 @@
#include <base/signal.h>
namespace Genode {
namespace Genode { template <typename, typename> class Signal_rpc_member; }
template <typename T, typename EP = Entrypoint>
struct Signal_rpc_member : Signal_handler<T, EP>
{
using Signal_handler<T, EP>::Signal_handler;
};
}
/**
* Signal dispatcher for handling signals by an object method
*
* This utility associates object methods with signals. It is intended to
* be used as a member variable of the class that handles incoming signals
* of a certain type. The constructor takes a pointer-to-member to the
* signal-handling method as argument. If a signal is received at the
* common signal reception code, this method will be invoked by calling
* 'Signal_dispatcher_base::dispatch'.
*
* \param T type of signal-handling class
* \param EP type of entrypoint handling signal RPC
*
* \deprecated this class template is superseded by the 'Signal_handler'
* in base/signal.h
*/
template <typename T, typename EP = Genode::Entrypoint>
struct Genode::Signal_rpc_member : Genode::Signal_dispatcher_base,
Genode::Signal_context_capability
{
EP &ep;
T &obj;
void (T::*member) (unsigned);
/**
* Constructor
*
* \param ep entrypoint managing this signal RPC
* \param obj,member object and method to call when
* the signal occurs
*/
Signal_rpc_member(EP &ep, T &obj, void (T::*member)(unsigned))
: Signal_context_capability(ep.manage(*this)),
ep(ep), obj(obj), member(member) { }
~Signal_rpc_member() { ep.dissolve(*this); }
/**
* Interface of Signal_dispatcher_base
*/
void dispatch(unsigned num) { (obj.*member)(num); }
};
#endif /* _INCLUDE__OS__SIGNAL_RPC_DISPATCHER_H_ */