Use the thread-pool record for the default timeout

Rather than a parameter.
This commit is contained in:
Christopher Baines 2025-02-10 15:16:37 +00:00
parent 6c083bdebd
commit d597b77fcb

View file

@ -151,7 +151,9 @@ from there, or #f if that would be an empty string."
thread-pool? thread-pool?
(channel thread-pool-channel) (channel thread-pool-channel)
(arguments-parameter thread-pool-arguments-parameter) (arguments-parameter thread-pool-arguments-parameter)
(proc-vector thread-pool-proc-vector)) (proc-vector thread-pool-proc-vector)
(default-checkout-timeout
thread-pool-default-checkout-timeout))
(define* (make-thread-pool size (define* (make-thread-pool size
#:key #:key
@ -163,7 +165,8 @@ from there, or #f if that would be an empty string."
(log-exception? (const #t)) (log-exception? (const #t))
(expire-on-exception? #f) (expire-on-exception? #f)
(name "unnamed") (name "unnamed")
(use-default-io-waiters? #t)) (use-default-io-waiters? #t)
default-checkout-timeout)
"Return a channel used to offload work to a dedicated thread. ARGS are the "Return a channel used to offload work to a dedicated thread. ARGS are the
arguments of the thread pool procedure." arguments of the thread pool procedure."
(define param (define param
@ -349,11 +352,9 @@ arguments of the thread pool procedure."
(define thread-pool-timeout-error? (define thread-pool-timeout-error?
(record-predicate &thread-pool-timeout)) (record-predicate &thread-pool-timeout))
(define %thread-pool-default-timeout
(make-parameter 30))
(define* (call-with-thread record proc #:key duration-logger (define* (call-with-thread record proc #:key duration-logger
(timeout (%thread-pool-default-timeout)) (timeout (thread-pool-default-checkout-timeout
record))
(channel (thread-pool-channel record))) (channel (thread-pool-channel record)))
"Send PROC to the thread pool through CHANNEL. Return the result of PROC. "Send PROC to the thread pool through CHANNEL. Return the result of PROC.
If already in the thread pool, call PROC immediately." If already in the thread pool, call PROC immediately."