From c102673339cf743698071227f73bfd6d6f82b942 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 7 Oct 2018 09:28:09 -0600 Subject: [PATCH] thread: add some reminders to the implementation These comments were meant to be part of e60a78aad9. --- racket/src/thread/custodian.rkt | 2 ++ racket/src/thread/thread.rkt | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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