Mercurial > urweb
annotate demo/threads.ur @ 2209:0ca11d57c175
Cleans up interface (it's now a command line option) and renames project to "sqlcache" in the all-one-word style. Still has issues to do with concurrency, retrying transactions, and foreign function calls that either rely on state or have side effects.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Sat, 31 May 2014 03:08:16 -0400 |
parents | 755a71c99be5 |
children |
rev | line source |
---|---|
adamc@697 | 1 fun main () = |
adamc@697 | 2 buf <- Buffer.create; |
adamc@697 | 3 let |
adamc@697 | 4 fun loop prefix delay = |
adamc@697 | 5 let |
adamc@697 | 6 fun loop' n = |
adamc@697 | 7 Buffer.write buf (prefix ^ ": Message #" ^ show n); |
adamc@697 | 8 sleep delay; |
adamc@697 | 9 loop' (n + 1) |
adamc@697 | 10 in |
adamc@697 | 11 loop' |
adamc@697 | 12 end |
adamc@697 | 13 in |
adamc@697 | 14 return <xml><body onload={spawn (loop "A" 5000 0); spawn (loop "B" 3000 100)}> |
adamc@697 | 15 <dyn signal={Buffer.render buf}/> |
adamc@697 | 16 </body></xml> |
adamc@697 | 17 end |