Scaffolding for handling the "when" of the run-request
authorChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 19 Nov 2015 20:28:58 +0000 (14:28 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 19 Nov 2015 20:28:58 +0000 (14:28 -0600)
loopy.scm

index 70d2d08ba7e2b42083452a3d5f30e8fe8f93f508..389d8e7a20dfe1583a8a911e47e39524eb4223eb 100644 (file)
--- a/loopy.scm
+++ b/loopy.scm
@@ -336,11 +336,16 @@ based on the results"
              (proc-result (call-proc proc))
              (enqueue
               (lambda (run-request)
-                (cond
-                 ((run-request-when run-request)
-                  (error "TODO"))
-                 (else
-                  (enq! next-queue (run-request-proc run-request)))))))
+                (match (run-request-when run-request)
+                  ((? time-delta? _)
+                   (error "TODO"))
+                  ((? integer? sec)
+                   (let ((time (cons sec 0)))
+                     (error "Also TODO")))
+                  (((? integer? sec) . (? integer? usec))
+                   (error "Also also TODO"))
+                  (#f
+                   (enq! next-queue (run-request-proc run-request)))))))
         ;; @@: We might support delay-wrapped procedures here
         (match proc-result
           ;; TODO: replace procedure with something that indicates