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
Motivation:
Adding support for capturing HUP too in addition to USR1/USR2.
Modifications:
* Added HUP signal, added descriptive strings for new signals.
* Optionally allow to let signal handler run multiple times, useful for USR signals
Result:
HUP and USR signals available.
/// - handler: closure to invoke when the signal is captured.
179
+
/// - on: DispatchQueue to run the signal handler on (default global dispatch queue)
180
+
/// - cancelAfterTrap: Defaults to false, which means the signal handler can be run multiple times. If true, the DispatchSignalSource will be cancelled after being trapped once.
179
181
/// - returns: a `DispatchSourceSignal` for the given trap. The source must be cancelled by the caller.
180
-
publicstaticfunc trap(signal sig:Signal, handler:@escaping(Signal)->Void, on queue:DispatchQueue=.global())->DispatchSourceSignal{
182
+
publicstaticfunc trap(signal sig:Signal, handler:@escaping(Signal)->Void, on queue:DispatchQueue=.global(), cancelAfterTrap:Bool=false)->DispatchSourceSignal{
0 commit comments