guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 02/06: shepherd: Spawn signal-handling fiber early on.


From: Ludovic Courtès
Subject: [shepherd] 02/06: shepherd: Spawn signal-handling fiber early on.
Date: Mon, 12 Jun 2023 09:39:21 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit 2b310bd3b0ba0d7a08c77b456d34369cd6444edb
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Jun 11 10:36:47 2023 +0200

    shepherd: Spawn signal-handling fiber early on.
    
    * modules/shepherd.scm (run-daemon): Spawn 'signal-handler' fiber before
    listening for connections.
---
 modules/shepherd.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 6bd30ca..d2e5f39 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -181,6 +181,10 @@ already ~a threads running, disabling 'signalfd' support")
   ;; mark them all as FD_CLOEXEC so child processes do not inherit them.
   (mark-as-close-on-exec)
 
+  ;; Spawn a signal handling fiber.
+  (spawn-fiber
+   (essential-task-thunk 'signal-handler signal-handler))
+
   ;; This _must_ succeed.  (We could also put the `catch' around
   ;; `main', but it is often useful to get the backtrace, and
   ;; `caught-error' does not do this yet.)
@@ -212,10 +216,6 @@ already ~a threads running, disabling 'signalfd' support")
            (#t (display (getpid)))
            (_  #t))
 
-         ;; Spawn a signal handling fiber.
-         (spawn-fiber
-          (essential-task-thunk 'signal-handler signal-handler))
-
          ;; Enter some sort of a REPL for commands.
          (let next-command ()
            (match (accept sock (logior SOCK_NONBLOCK SOCK_CLOEXEC))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]