[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 07/12: service: 'service-running-value' uses a fresh channel
From: |
Ludovic Courtès |
Subject: |
[shepherd] 07/12: service: 'service-running-value' uses a fresh channel for each reply. |
Date: |
Sun, 19 Feb 2023 16:58:37 -0500 (EST) |
civodul pushed a commit to branch wip-service-monitor
in repository shepherd.
commit a460085e302108e2d7a77833d7f93028f53df302
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Feb 19 16:04:56 2023 +0100
service: 'service-running-value' uses a fresh channel for each reply.
This avoids confusion if 'service-running-value' might be called from
different fibers concurrently.
* modules/shepherd/service.scm (service-running-value): Use a fresh
channel for each reply.
---
modules/shepherd/service.scm | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 34e23b1..f88781c 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -336,15 +336,14 @@ wire."
(define-method (canonical-name (obj <service>))
(car (provided-by obj)))
-(define service-running-value
+(define (service-running-value service)
+ "Return the \"running value\" of SERVICE."
(let ((reply (make-channel)))
- (lambda (service)
- "Return the \"running value\" of SERVICE."
- (put-message (current-monitor-channel)
- `(running ,service ,reply))
- (match (get-message reply)
- ((? procedure? proc) (proc))
- (value value)))))
+ (put-message (service-control service)
+ `(running ,reply))
+ (match (get-message reply)
+ ((? procedure? proc) (proc))
+ (value value))))
;; Return whether the service is currently running.
(define-method (running? (obj <service>))
- [shepherd] branch wip-service-monitor created (now da158c5), Ludovic Courtès, 2023/02/19
- [shepherd] 01/12: service: Remove 'stop-delay?' and 'waiting-for-termination?'., Ludovic Courtès, 2023/02/19
- [shepherd] 02/12: service: Handle service state in a monitoring agent., Ludovic Courtès, 2023/02/19
- [shepherd] 06/12: service: 'stop' blocks when a service is already being stopped., Ludovic Courtès, 2023/02/19
- [shepherd] 09/12: service: Rename "service monitor" to "service registry"., Ludovic Courtès, 2023/02/19
- [shepherd] 10/12: service: Clarify expected statuses., Ludovic Courtès, 2023/02/19
- [shepherd] 05/12: service: 'start-in-the-background' starts services in parallel., Ludovic Courtès, 2023/02/19
- [shepherd] 03/12: service: 'start' blocks when a service is already being started., Ludovic Courtès, 2023/02/19
- [shepherd] 04/12: service: Start dependent services in parallel., Ludovic Courtès, 2023/02/19
- [shepherd] 07/12: service: 'service-running-value' uses a fresh channel for each reply.,
Ludovic Courtès <=
- [shepherd] 11/12: service: Communicate the service status symbol to clients., Ludovic Courtès, 2023/02/19
- [shepherd] 12/12: herd: Report 'starting' and 'stopping' service statuses., Ludovic Courtès, 2023/02/19
- [shepherd] 08/12: service: Associate a control fiber with each service., Ludovic Courtès, 2023/02/19