comparison tests/goodbye.ur @ 1707:c05e2e4bdde7

Refactor to avoid dependence on recursive mutexes
author Adam Chlipala <adam@chlipala.net>
date Sun, 08 Apr 2012 16:24:16 -0400
parents
children
comparison
equal deleted inserted replaced
1706:0152f65ced6a 1707:c05e2e4bdde7
1 table boo : { Client : client, Channel : channel unit }
2
3 fun doIt () =
4 me <- self;
5 ch <- channel;
6 dml (INSERT INTO boo (Client, Channel) VALUES ({[me]}, {[ch]}));
7 return <xml><body onload={let
8 fun loop () =
9 v <- recv ch;
10 alert "Someone left";
11 loop ()
12 in
13 loop ()
14 end}/></xml>
15
16 task clientLeaves = fn cl =>
17 debug "Client left";
18 dml (DELETE FROM boo WHERE Client = {[cl]});
19 queryI (SELECT (boo.Channel)
20 FROM boo)
21 (fn r => send r.1 ());
22 debug "Done processing"
23
24 fun main () = return <xml><body>
25 <form> <submit action={doIt}/> </form>
26 </body></xml>