cs & thread: avoid counting a descheduled thread as "no progress"

It's not clear that a thread can be descheduled without the current
thread's work counting as progress, but a descheduled thread certainly
shouldn't coun as a no-progress scheduled thread.
This commit is contained in:
Matthew Flatt 2019-09-18 14:01:20 -06:00
parent 19efcb955d
commit 2b567b4488

View File

@ -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