From e97adefde985e30fe31ffa036c74ffb0ce10ca26 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Tue, 1 Mar 2011 21:12:56 +0100 Subject: * fixed potential crash at application shutdown when calling lua_close() on a killed thread's VM. * exposed cancel_test() in the lanes to enable manual testing for cancellation requests. * removed kludgy {globals={threadName}} support, replaced with a new function set_debug_threadname(). --- tests/atexit.lua | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/atexit.lua (limited to 'tests') diff --git a/tests/atexit.lua b/tests/atexit.lua new file mode 100644 index 0000000..fb4f34a --- /dev/null +++ b/tests/atexit.lua @@ -0,0 +1,45 @@ +require "lanes" + +-- create a free-running lane + +local linda = lanes.linda() + +local f = function( _linda) + _linda:receive("oy") +end + +local g = function() + local cancelled + repeat + cancelled = cancel_test() + until cancelled + print "User cancellation detected!" +end + +local genF = lanes.gen( "", {globals = {threadName = "mylane"}}, f) +local genG = lanes.gen( "", g) + + +-- launch a good batch of free running lanes +for i = 1, 10 do + -- if i%50 == 0 then print( i) end + local h = genF( linda) + local status + repeat + status = h.status + --print( status) + until status == "waiting" + + -- [[ + local h = genG() + local status + repeat + status = h.status + --print( status) + until status == "running" + --]] +end + +print "exiting" + +-- let process end terminate them and see what happens \ No newline at end of file -- cgit v1.2.3-55-g6feb