summaryrefslogtreecommitdiff
path: root/demo/threads.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-05 10:48:11 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-05 10:48:11 -0400
commit18b7332e738d4b97bf3bb9dfa6600277222aab33 (patch)
tree0a616d813984767dcc70ab5fe7b6409237851fc5 /demo/threads.ur
parentc042b1bb94be89cc99fe4226edc3ce920d99f56b (diff)
Threads demo
Diffstat (limited to 'demo/threads.ur')
-rw-r--r--demo/threads.ur17
1 files changed, 17 insertions, 0 deletions
diff --git a/demo/threads.ur b/demo/threads.ur
new file mode 100644
index 00000000..ac6d8cee
--- /dev/null
+++ b/demo/threads.ur
@@ -0,0 +1,17 @@
+fun main () =
+ buf <- Buffer.create;
+ let
+ fun loop prefix delay =
+ let
+ fun loop' n =
+ Buffer.write buf (prefix ^ ": Message #" ^ show n);
+ sleep delay;
+ loop' (n + 1)
+ in
+ loop'
+ end
+ in
+ return <xml><body onload={spawn (loop "A" 5000 0); spawn (loop "B" 3000 100)}>
+ <dyn signal={Buffer.render buf}/>
+ </body></xml>
+ end