diff options
author | 2009-04-16 13:00:40 -0400 | |
---|---|---|
committer | 2009-04-16 13:00:40 -0400 | |
commit | b6fef1cc8832978bd9673df1a968d06d42bc2eb0 (patch) | |
tree | 517b9c66d187dc97c0e7fbe181f43d9fefbef929 /tests/buffer.ur | |
parent | 966f716a755bd954d817b43d1efaaeb6f939ad89 (diff) |
Avoid thread death via message receive
Diffstat (limited to 'tests/buffer.ur')
-rw-r--r-- | tests/buffer.ur | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/buffer.ur b/tests/buffer.ur new file mode 100644 index 00000000..27e2b805 --- /dev/null +++ b/tests/buffer.ur @@ -0,0 +1,25 @@ +datatype lines = End | Line of string * source lines + +type t = { Head : source lines, Tail : source (source lines) } + +val create = + head <- source End; + tail <- source head; + return {Head = head, Tail = tail} + +fun renderL lines = + case lines of + End => <xml/> + | Line (line, linesS) => <xml>{[line]}<br/><dyn signal={renderS linesS}/></xml> + +and renderS linesS = + lines <- signal linesS; + return (renderL lines) + +fun render t = renderS t.Head + +fun write t s = + oldTail <- get t.Tail; + newTail <- source End; + set oldTail (Line (s, newTail)); + set t.Tail newTail |