diff --git a/racket/src/thread/custodian.rkt b/racket/src/thread/custodian.rkt index 641bf80aba..4cf9b8666d 100644 --- a/racket/src/thread/custodian.rkt +++ b/racket/src/thread/custodian.rkt @@ -129,6 +129,8 @@ (check who custodian? c) (atomically (do-custodian-shutdown-all c)) + ;; Set in "thread.rkt" to check whether the current thread + ;; should be swapped out (post-shutdown-action)) ;; In atomic mode diff --git a/racket/src/thread/thread.rkt b/racket/src/thread/thread.rkt index 76f87958d1..c0e938c7c4 100644 --- a/racket/src/thread/thread.rkt +++ b/racket/src/thread/thread.rkt @@ -401,6 +401,8 @@ (add-to-sleeping-threads! t (sandman-merge-timeout #f timeout-at))) (when (eq? t (current-thread)) (thread-did-work!)) + ;; Beware that this thunk is not used when a thread is descheduled + ;; but a custodian callback (lambda () (when (eq? t (current-thread)) (when (positive? (current-atomic)) @@ -454,7 +456,9 @@ ;; in atomic mode ;; Returns a thunk to call to handle the case that -;; the current thread is suspended +;; the current thread is suspended; beware that the +;; thunk is not used when `custodian-shutdown-all` +;; suspends a thread (define (do-thread-suspend t) (assert-atomic-mode) (cond