Mercurial > urweb
annotate tests/threads.ur @ 2068:b6adfe99bb08
Check realloc's return code to prevent segfault on out of memory condition (Part 2)
author | Sergey Mironov <grrwlf@gmail.com> |
---|---|
date | Sun, 24 Aug 2014 11:56:41 +0400 |
parents | 2197f0e24a9f |
children |
rev | line source |
---|---|
adamc@728 | 1 fun main () = |
adamc@728 | 2 buf <- Buffer.create; |
adamc@728 | 3 let |
adamc@728 | 4 fun loop1 () = |
adamc@728 | 5 Buffer.write buf "A"; |
adamc@728 | 6 sleep 9; |
adamc@728 | 7 loop1 () |
adamc@728 | 8 |
adamc@728 | 9 fun loop2 () = |
adamc@728 | 10 Buffer.write buf "B"; |
adamc@728 | 11 sleep 9; |
adamc@728 | 12 error <xml>Darn</xml> |
adamc@728 | 13 loop2 () |
adamc@728 | 14 in |
adamc@728 | 15 return <xml><body onload={spawn (loop1 ()); loop2 ()}> |
adamc@728 | 16 <dyn signal={Buffer.render buf}/> |
adamc@728 | 17 </body></xml> |
adamc@728 | 18 end |