DRY (by using wait-until-time)

This commit is contained in:
Tony Garnock-Jones 2012-01-11 16:38:53 -05:00
parent d44f0fb14c
commit 9f3003fc40
1 changed files with 4 additions and 6 deletions

View File

@ -17,7 +17,7 @@
(wait (message-handlers
[`(request ,reply-addr ,pattern)
(spawn (lambda ()
(define answer (begin body ...))
(define answer (let () body ...))
(send `(reply ,reply-addr ,answer))))
(loop)])))]))
@ -50,11 +50,9 @@
(define (sleep-driver)
(rpc-service `(sleep ,msecs)
(send `(display (Sleeping ,msecs)))
(wait (message-handlers)
(meta-message-handlers
[((time-evt (+ (current-time) msecs)) => now)
(send `(display "\n"))
now]))))
(define now (wait-until-time (+ (current-time) msecs)))
(send `(display "\n"))
now))
(define (main)
(spawn display-driver)