diff --git a/racket/src/thread/thread.rkt b/racket/src/thread/thread.rkt index 943c4696e8..2e1c395cf6 100644 --- a/racket/src/thread/thread.rkt +++ b/racket/src/thread/thread.rkt @@ -266,7 +266,8 @@ (when (thread-dead-sema t) (semaphore-post-all (thread-dead-sema t))) (unless (thread-descheduled? t) - (thread-group-remove! (thread-parent t) t)) + (thread-group-remove! (thread-parent t) t) + (thread-unscheduled-for-work-tracking! t)) (remove-from-sleeping-threads! t) (run-kill-callbacks! t) (when (thread-forward-break-to t) @@ -423,6 +424,7 @@ (internal-error "tried to deschedule a descheduled thread")) (set-thread-descheduled?! t #t) (thread-group-remove! (thread-parent t) t) + (thread-unscheduled-for-work-tracking! t) (when timeout-at (add-to-sleeping-threads! t (sandman-merge-timeout #f timeout-at))) (when (eq? t (current-thread/in-atomic)) @@ -733,6 +735,9 @@ (define (thread-did-work!) (set! poll-done-threads #hasheq())) +(define (thread-unscheduled-for-work-tracking! t) + (set! poll-done-threads (hash-remove poll-done-threads t))) + ;; ---------------------------------------- ;; Breaks