You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a networking service needs a graceful config file restart or graceful shutdown of the worker threads or graceful shutdown, we have a specification for the list of signals and how the master process handles those signals by running specific code in the event of the specific signals.
It's better to have some abstraction to handle the code/helper subroutine execution service. The service class takes the list of signals and their callbacks to execute in the event.
It's also good to make the callback with a signature of void fn(Callable). In which we just invoke the callback. We assume that invoked callback doesn't take any arguments and also doesn't return some values which the user might be interested in. If they need to pass a piece of state information, they must have a class with operator()() overload to get around that.
Finally, we have a single method which the user should invoke to activate the signal handler since we don't take all the signal callbacks on the constructor.
We've a void signal_handler::install_callback(signal_type, callable_type) to take the callabcks and a switch-case jump statements to install the callbacks.
switch(signal_type) {
case signal_type_one:
callback_one = callback_type;
return0;
case signal_type_two:
callback_two = callback_type;
return0;
default:
return -1;
The text was updated successfully, but these errors were encountered:
When a networking service needs a graceful config file restart or graceful shutdown of the worker threads or graceful shutdown, we have a specification for the list of signals and how the master process handles those signals by running specific code in the event of the specific signals.
It's better to have some abstraction to handle the code/helper subroutine execution service. The service class takes the list of signals and their callbacks to execute in the event.
It's also good to make the callback with a signature of
void fn(Callable)
. In which we just invoke the callback. We assume that invoked callback doesn't take any arguments and also doesn't return some values which the user might be interested in. If they need to pass a piece of state information, they must have a class withoperator()()
overload to get around that.Finally, we have a single method which the user should invoke to activate the signal handler since we don't take all the signal callbacks on the constructor.
We've a
void signal_handler::install_callback(signal_type, callable_type)
to take the callabcks and a switch-case jump statements to install the callbacks.The text was updated successfully, but these errors were encountered: