diff --git a/syndicate-examples/timer-demo.rkt b/syndicate-examples/timer-demo.rkt new file mode 100644 index 0000000..95a3386 --- /dev/null +++ b/syndicate-examples/timer-demo.rkt @@ -0,0 +1,13 @@ +#lang syndicate +;;; SPDX-License-Identifier: LGPL-3.0-or-later +;;; SPDX-FileCopyrightText: Copyright © 2021 Tony Garnock-Jones + +(require syndicate/drivers/timer) + +(module+ main + (actor-system/dataspace (ds) + (spawn-timer-driver ds) + (spawn (at ds + (log-info "waiting...") + (stop-when-timeout 2000 + (log-info "done!")))))) diff --git a/syndicate/drivers/timer.rkt b/syndicate/drivers/timer.rkt index 25a5bb8..87fc3b4 100644 --- a/syndicate/drivers/timer.rkt +++ b/syndicate/drivers/timer.rkt @@ -114,10 +114,3 @@ (define-syntax-rule (stop-when-timeout relative-msecs body ...) (on-timeout relative-msecs (stop-current-facet body ...))) - -(module+ main - (actor-system/dataspace (ds) - (spawn-timer-driver ds) - (spawn (at ds - (stop-when-timeout 2000 - (log-info "hi!"))))))