summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurtis McEnroe2018-12-01 21:55:32 -0500
committerCurtis McEnroe2018-12-01 21:55:32 -0500
commite3cff14e0336b70bb7aad4855b8b2f6c4d963d05 (patch)
tree33777593da6cb8e99f56383b6cb8deb775cf20a4
parente708b795b5f77969f2d3001c9382be01c8205006 (diff)
Fix sandman hang
It was hanging after sending SIGTSTP to its child, then receiving a SIGCHLD to indicate the child had stopped.
-rw-r--r--sandman.m6
1 files changed, 3 insertions, 3 deletions
diff --git a/sandman.m b/sandman.m
index 44ab267..e8163c0 100644
--- a/sandman.m
+++ b/sandman.m
@@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
struct sigaction sa = {
.sa_handler = handler,
.sa_mask = mask,
- .sa_flags = SA_RESTART,
+ .sa_flags = SA_NOCLDSTOP | SA_RESTART,
};
sigaction(SIGCHLD, &sa, NULL);
@@ -56,7 +56,7 @@ int main(int argc, char *argv[]) {
[[NSWorkspace sharedWorkspace] notificationCenter]
addObserverForName: NSWorkspaceWillSleepNotification
object: nil
- queue: [NSOperationQueue mainQueue]
+ queue: nil
usingBlock: ^(NSNotification *note) {
(void)note;
int error = kill(pid, SIGTSTP);
@@ -68,7 +68,7 @@ int main(int argc, char *argv[]) {
[[NSWorkspace sharedWorkspace] notificationCenter]
addObserverForName: NSWorkspaceDidWakeNotification
object: nil
- queue: [NSOperationQueue mainQueue]
+ queue: nil
usingBlock: ^(NSNotification *note) {
(void)note;
int error = kill(pid, SIGCONT);