'Signal[].Send()' is a new method for sending a signal.

[GB.SIGNAL]
* NEW: 'Signal[].Send()' is a new method for sending a signal. It's an alternative syntax to the 'Signal.Send()' method.
This commit is contained in:
Benoît Minisini 2022-06-20 01:37:54 +02:00
parent 7f182bff2f
commit f0d3f2e8c3

View file

@ -192,7 +192,14 @@ BEGIN_METHOD_VOID(Signal_exit)
END_METHOD
BEGIN_METHOD(Signal_Send, GB_INTEGER pid; GB_INTEGER sig)
BEGIN_METHOD(Signal_Send, GB_INTEGER pid)
if (kill(VARG(pid), _signal))
GB.Error("Unable to send signal: &1", strerror(errno));
END_METHOD
BEGIN_METHOD(Signal_SendOld, GB_INTEGER pid; GB_INTEGER sig)
if (kill(VARG(pid), VARG(sig)))
GB.Error("Unable to send signal: &1", strerror(errno));
@ -207,6 +214,7 @@ GB_DESC CSignalHandlerDesc[] =
GB_STATIC_METHOD("Reset", NULL, Signal_Reset, NULL),
GB_STATIC_METHOD("Ignore", NULL, Signal_Ignore, NULL),
GB_STATIC_METHOD("Catch", NULL, Signal_Catch, NULL),
GB_STATIC_METHOD("Send", NULL, Signal_Send, "(Process)i"),
GB_END_DECLARE
};
@ -254,7 +262,7 @@ GB_DESC CSignalDesc[] =
GB_STATIC_METHOD("_get", ".SignalHandler", Signal_get, "(Signal)i"),
GB_STATIC_METHOD("Send", NULL, Signal_Send, "(Process)i(Signal)i"),
GB_STATIC_METHOD("Send", NULL, Signal_SendOld, "(Process)i(Signal)i"),
GB_END_DECLARE
};