From 2d7100e75d1b6f151b094995ea3f4c7e8a37c22b Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 31 Oct 2024 16:44:15 +0000 Subject: Add call-with-default-io-waiters As this is useful when starting threads from a fibers context. --- guix-data-service/utils.scm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/guix-data-service/utils.scm b/guix-data-service/utils.scm index 25624e4..fda40b3 100644 --- a/guix-data-service/utils.scm +++ b/guix-data-service/utils.scm @@ -52,6 +52,7 @@ with-resource-from-pool resource-pool-stats + call-with-default-io-waiters make-worker-thread-channel %worker-thread-default-timeout call-with-worker-thread @@ -497,6 +498,14 @@ available. Return the resource once PROC has returned." (raise-exception (make-resource-pool-timeout-error)))))) +(define (call-with-default-io-waiters thunk) + (parameterize + ((current-read-waiter (@@ (ice-9 suspendable-ports) + default-read-waiter)) + (current-write-waiter (@@ (ice-9 suspendable-ports) + default-write-waiter))) + (thunk))) + (define %worker-thread-args (make-parameter #f)) -- cgit v1.2.3