summaryrefslogtreecommitdiff
path: root/demo/threads.ur
blob: ac6d8ceeb2b279db08906b9991edae7140d71690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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