comparison tests/buffer.ur @ 728:2197f0e24a9f

Avoid thread death via message receive
author Adam Chlipala <adamc@hcoop.net>
date Thu, 16 Apr 2009 13:00:40 -0400
parents
children
comparison
equal deleted inserted replaced
727:ba4c230b7231 728:2197f0e24a9f
1 datatype lines = End | Line of string * source lines
2
3 type t = { Head : source lines, Tail : source (source lines) }
4
5 val create =
6 head <- source End;
7 tail <- source head;
8 return {Head = head, Tail = tail}
9
10 fun renderL lines =
11 case lines of
12 End => <xml/>
13 | Line (line, linesS) => <xml>{[line]}<br/><dyn signal={renderS linesS}/></xml>
14
15 and renderS linesS =
16 lines <- signal linesS;
17 return (renderL lines)
18
19 fun render t = renderS t.Head
20
21 fun write t s =
22 oldTail <- get t.Tail;
23 newTail <- source End;
24 set oldTail (Line (s, newTail));
25 set t.Tail newTail