io: fix unsafe-poller

When asking a poller to register wakup events, handle an
"event is ready" response by canceling the sleep.

Closes #2482
This commit is contained in:
Matthew Flatt 2019-02-16 17:39:58 -07:00
parent edeae791ab
commit 0567527be4

View File

@ -22,7 +22,13 @@
[vals (values vals #f)]
[(eq? evt self)
;; Register wakeups:
(proc self poll-ctx)
(define-values (vals evt) (proc self poll-ctx))
(when vals
;; The rule here is that we cancel any sleep so
;; that the event will be polled again; we do not
;; select the event now. That rule accomodates
;; the old Racket scheduler.
(sandman-poll-ctx-merge-timeout poll-ctx (current-inexact-milliseconds)))
(values #f self)]
[else
(values #f evt)])]))))