racket/promise: repairs for custodian change
Closes #2973 Note that the test is in the "lazy" package, commit 2cc3a24343.
This commit is contained in:
parent
15c0e34bed
commit
2d695be78c
|
@ -117,10 +117,14 @@
|
|||
(thread-group? group))
|
||||
(raise-argument-error 'delay/thread "(or/c thread-group? #f)" group))
|
||||
(define initialized-sema (make-semaphore))
|
||||
(define orig-c (current-custodian))
|
||||
(define (run)
|
||||
(semaphore-wait initialized-sema) ; wait until p is properly defined
|
||||
(call-with-exception-handler
|
||||
(λ(e) (pset! p (make-reraise e)) (kill-thread (current-thread)))
|
||||
(λ (e)
|
||||
(pset! p (make-reraise e))
|
||||
(parameterize ([current-custodian orig-c])
|
||||
(kill-thread (current-thread))))
|
||||
(λ () (pset! p (call-with-values thunk list)))))
|
||||
(define p
|
||||
(make-promise/thread
|
||||
|
@ -164,9 +168,13 @@
|
|||
(define use (cond [(use* . <= . 0) 0] [(use* . >= . 1) 1] [else use*]))
|
||||
(define work-time (* tick use))
|
||||
(define rest-time (- tick work-time))
|
||||
(define orig-c (current-custodian))
|
||||
(define (work)
|
||||
(call-with-exception-handler
|
||||
(λ(e) (pset! p (make-reraise e)) (kill-thread (current-thread)))
|
||||
(λ (e)
|
||||
(pset! p (make-reraise e))
|
||||
(parameterize ([current-custodian orig-c])
|
||||
(kill-thread (current-thread))))
|
||||
(λ () (pset! p (call-with-values thunk list)))))
|
||||
(define (run)
|
||||
;; this thread is dedicated to controlling the worker thread, so it's
|
||||
|
|
Loading…
Reference in New Issue
Block a user