adamc@698: table channels : { Client : client, Channel : channel (string * int * float) }
adamc@708: PRIMARY KEY Client
adamc@698:
adamc@698: fun writeBack v =
adamc@698: me <- self;
adamc@698: r <- oneRow (SELECT channels.Channel FROM channels WHERE channels.Client = {[me]});
adamc@698: send r.Channels.Channel v
adamc@698:
adamc@733: fun action () =
adamc@698: me <- self;
adamc@698: ch <- channel;
adamc@698: dml (INSERT INTO channels (Client, Channel) VALUES ({[me]}, {[ch]}));
adamc@698:
adamc@698: buf <- Buffer.create;
adamc@698:
adamc@698: let
adamc@698: fun receiver () =
adamc@698: v <- recv ch;
adamc@698: Buffer.write buf ("(" ^ v.1 ^ ", " ^ show v.2 ^ ", " ^ show v.3 ^ ")");
adamc@698: receiver ()
adamc@698:
adamc@698: fun sender s n f =
adamc@698: sleep 2000;
adamc@698: writeBack (s, n, f);
adamc@698: sender (s ^ "!") (n + 1) (f + 1.23)
adamc@698: in
adamc@698: return
adamc@698:
adamc@698:
adamc@698: end
adamc@733:
adamc@733: fun main () = return
adamc@733:
adamc@733: