cs: wake up main thread blocked on fsemaphore

If a future posts to an fsemaphore that the main thread is waiting on
but went to sleep, then be sure to wake up the main thread.

Relevant to #2957
This commit is contained in:
Matthew Flatt 2019-12-09 07:15:20 -07:00
parent 6db1bdda1b
commit a319b7e073
2 changed files with 5 additions and 3 deletions

View File

@ -53,12 +53,13 @@
(set-fsemaphore-dependents! fs (hash-remove deps f))
(future-notify-dependent f)]
[else
(set-fsemaphore-c! fs 1)
(when b
;; This is a kind of broadcast wakeup, and then the
;; awakened threads will compete for the fsemaphore:
(set-fsemaphore-dep-box! fs #f)
(set-box! b #t))
(set-fsemaphore-c! fs 1)])]
(set-box! b #t)
(wakeup-this-place))])]
[else
(set-fsemaphore-c! fs (add1 c))])))

View File

@ -43,7 +43,8 @@
(provide future*-lock
set-future*-state!
future-suspend
future-notify-dependent))
future-notify-dependent
wakeup-this-place))
(define (init-future-place!)
(init-future-logging-place!))