diff options
author | Christopher Baines <mail@cbaines.net> | 2024-10-31 16:44:15 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-10-31 16:44:15 +0000 |
commit | 2d7100e75d1b6f151b094995ea3f4c7e8a37c22b (patch) | |
tree | b04bc020893838cdb0af2b339e8007bf99d21ecb | |
parent | 55af7c82e8e69954bc9f9625a62426dc10997919 (diff) | |
download | data-service-2d7100e75d1b6f151b094995ea3f4c7e8a37c22b.tar data-service-2d7100e75d1b6f151b094995ea3f4c7e8a37c22b.tar.gz |
Add call-with-default-io-waiters
As this is useful when starting threads from a fibers context.
-rw-r--r-- | guix-data-service/utils.scm | 9 |
1 files changed, 9 insertions, 0 deletions
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)) |