comparison demo/threads.ur @ 697:755a71c99be5

Threads demo
author Adam Chlipala <adamc@hcoop.net>
date Sun, 05 Apr 2009 10:48:11 -0400
parents
children
comparison
equal deleted inserted replaced
696:79a49c509007 697:755a71c99be5
1 fun main () =
2 buf <- Buffer.create;
3 let
4 fun loop prefix delay =
5 let
6 fun loop' n =
7 Buffer.write buf (prefix ^ ": Message #" ^ show n);
8 sleep delay;
9 loop' (n + 1)
10 in
11 loop'
12 end
13 in
14 return <xml><body onload={spawn (loop "A" 5000 0); spawn (loop "B" 3000 100)}>
15 <dyn signal={Buffer.render buf}/>
16 </body></xml>
17 end