Inert role to permit clients of the timer driver to wait for it to start.

This commit is contained in:
Tony Garnock-Jones 2012-06-20 23:54:58 -04:00
parent 40912af499
commit ba5c639814
1 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,7 @@
;; correct linear use of the various pointers.
(require data/heap)
(require racket/set)
(require racket/match)
(require "os2.rkt")
@ -84,7 +85,8 @@
;; events and back.
(define (timer-driver self-id)
(transition (driver-state self-id (make-timer-heap))
(role 'relay-down (topic-subscriber (set-timer (wild) (wild) (wild)))
(role 'relay-down (set (topic-subscriber (set-timer (wild) (wild) (wild)))
(topic-publisher (timer-expired (wild) (wild))))
#:state state
[(set-timer label msecs 'relative)
(install-timer! state label (+ (current-inexact-milliseconds) msecs))]
@ -123,7 +125,8 @@
(transition (relay-state next-counter (hash-remove active-timers counter))
(and (hash-has-key? active-timers counter)
(send-message (timer-expired (hash-ref active-timers counter) now))))]))
(role 'relay-down (topic-subscriber (set-timer (wild) (wild) (wild)))
(role 'relay-down (set (topic-subscriber (set-timer (wild) (wild) (wild)))
(topic-publisher (timer-expired (wild) (wild))))
#:state (relay-state next-counter active-timers)
[(set-timer label msecs kind)
(transition (relay-state (+ next-counter 1) (hash-set active-timers next-counter label))