Skip to content

Commit dc710a3

Browse files
authored
AsyncSignalHandler: Add helper to catch all signals (#722)
1 parent 57d157c commit dc710a3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Sources/ContainerizationOS/AsyncSignalHandler.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ public final class AsyncSignalHandler: Sendable {
7878

7979
private let state: Mutex<State> = .init(State())
8080

81+
/// Create a new `AsyncSignalHandler` that catches all signals.
82+
public static func catchAll() -> AsyncSignalHandler {
83+
#if os(macOS)
84+
let range = 1...31
85+
#else
86+
let range = 1...64
87+
#endif
88+
return create(notify: range.map { Int32($0) })
89+
}
90+
8191
/// Create a new `AsyncSignalHandler` for the list of given signals `notify`.
8292
/// The default signal handlers for these signals are removed and async handlers
8393
/// added in their place. The async signal handlers that are installed simply

0 commit comments

Comments
 (0)