cs & thread: repair suspending a thread that is currently in sleep

Thanks to Greg Rosenblatt for the report.
This commit is contained in:
Matthew Flatt 2020-11-07 17:35:30 -07:00
parent db195a52b5
commit 7a12b4ac93
3 changed files with 13 additions and 1 deletions

View File

@ -1013,6 +1013,17 @@
(goes (lambda () (sync (system-idle-evt))) (lambda () (sync (system-idle-evt))) kill-thread)))
(list sleep void))
;; Suspend and sleep
(when (run-unreliable-tests? 'timing)
(let ([done? #f])
(define t (thread (lambda ()
(sleep 0.1)
(set! done? #t))))
(sync (system-idle-evt))
(thread-suspend t)
(sleep 0.1)
(test #f 'suspended-while-sleeping done?)))
;; ----------------------------------------
;; Simple multi-custodian threads

View File

@ -7663,7 +7663,7 @@
(void)))))))
(if (not (thread-descheduled? t_0))
(do-thread-deschedule! t_0 #f)
void)))))
(begin (remove-from-sleeping-threads! t_0) void))))))
(define 1/thread-resume
(let ((thread-resume_0
(|#%name|

View File

@ -512,6 +512,7 @@
[(not (thread-descheduled? t))
(do-thread-deschedule! t #f)]
[else
(remove-from-sleeping-threads! t)
void])]))
(define/who (thread-resume t [benefactor #f])