diff timer.ur @ 0:37eefd0a2ed4

Import code from elsewhere
author Adam Chlipala <adam@chlipala.net>
date Tue, 14 Dec 2010 10:55:22 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/timer.ur	Tue Dec 14 10:55:22 2010 -0500
@@ -0,0 +1,13 @@
+type t = source bool
+
+fun create r =
+    b <- source False;
+    spawn (sleep r.Milliseconds;
+           b <- get b;
+           if b then
+               return ()
+           else
+               r.Action);
+    return b
+
+fun cancel b = set b True