[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 02/03: shepherd: Replace ‘sleep’.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 02/03: shepherd: Replace ‘sleep’. |
Date: |
Sun, 8 Oct 2023 17:20:03 -0400 (EDT) |
civodul pushed a commit to branch master
in repository shepherd.
commit fc75133d39271ab548629c846ce26ab63a02fb98
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Oct 8 22:03:06 2023 +0200
shepherd: Replace ‘sleep’.
* modules/shepherd.scm (main): Add ‘sleep’ to the list of replaced
bindings.
* NEWS: Update.
---
NEWS | 9 +++++++++
modules/shepherd.scm | 6 ++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 268059b..6e05177 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,15 @@ Copyright © 2013-2014, 2016, 2018-2020, 2022-2023 Ludovic
Courtès <ludo@gnu.or
Please send Shepherd bug reports to bug-guix@gnu.org.
+* Changes in 0.10.3
+
+** Non-blocking ‘sleep’ replacement provided
+
+Until now, user code could call (@ (guile) sleep), the core Guile binding for
+‘sleep’, instead of ‘sleep’ as provided by (fibers). The former would have
+caused ‘shepherd’ to actually sleep for that time, instead of performing other
+on-going tasks. ‘sleep’ is now replaced by (@ (fibers) sleep) to avoid that.
+
* Changes in 0.10.2
** ‘shepherd’ loads configuration file asynchronously
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 2730213..efc5517 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -460,12 +460,14 @@ fork in the child process."
;; Replace the default 'system*' binding with one that
;; cooperates instead of blocking on 'waitpid'. Replace
;; 'primitive-load' (in C as of 3.0.9) with one that does
- ;; not introduce a continuation barrier.
+ ;; not introduce a continuation barrier. Replace 'sleep' to
+ ;; avoid blocking in user code such as 'start' methods.
(replace-core-bindings!
(system* (lambda command
(spawn-command command)))
(system spawn-shell-command)
- (primitive-load primitive-load*))
+ (primitive-load primitive-load*)
+ (sleep (@ (fibers) sleep)))
(run-daemon #:socket-file socket-file
#:config-file (or config-file (default-config-file))