Skip to content

Commit 63c5c95

Browse files
committed
Update the Readme
1 parent d953ec7 commit 63c5c95

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Readme.adoc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
= Signal Handling in Swift
22
François Lamboley <francois[email protected]>
33

4-
This package gives you a Swift syntax for the low-level C `sigaction` function,
5-
and provides a way to delay signals until the registered handlers allow the
6-
signal to go through.
4+
This package provides a Swift syntax for the low-level C `sigaction` function
5+
and a way to delay or cancel sigaction handlers.
76

87
== Example of Use
98

@@ -19,25 +18,27 @@ let action = Sigaction(handler: .ansiC({ sigID in
1918
try action.install(on: .terminated)
2019
----
2120

22-
Example of a delayed signal:
21+
Example of a delayed sigaction:
2322

2423
[source,swift]
2524
----
2625
let delayedSigaction = try SigactionDelayer_Unsig.registerDelayedSigaction(Signal.terminated, handler: { signal, doneHandler in
2726
logger.debug("Received signal \(signal); delaying it to clean-up")
28-
asyncCleanUp{
27+
myAsyncCleanUp{
2928
logger.debug("Cleanup is done, allowing signal to go through")
3029
doneHandler(true)
3130
})
3231
})
3332
----
3433

35-
When both examples are put in the same code, when the program receives the
36-
terminated signal (15 on macOS), the following should be logged:
34+
With both examples in the same code, when the program receives the terminated
35+
signal (15 on macOS), the following will be logged:
3736

3837
[source,text]
3938
----
4039
Received signal SIGTERM; delaying it to clean-up
4140
Cleanup is done, allowing signal to go through
4241
Handling signal SIGTERM from sigaction
4342
----
43+
44+
== How Does Delaying the Sigaction Work?

0 commit comments

Comments
 (0)