aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-06-14 12:25:23 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-06-14 12:25:23 +0200
commit792128255b6c6add22f97ea60734181cb915f2ae (patch)
treec3d8e3a3466639591245495ec0148d49732193c3 /tests
parent6177a3c6b5a05ac2c64978ccf3ca11de9793505b (diff)
downloadlanes-792128255b6c6add22f97ea60734181cb915f2ae.tar.gz
lanes-792128255b6c6add22f97ea60734181cb915f2ae.tar.bz2
lanes-792128255b6c6add22f97ea60734181cb915f2ae.zip
More fixes to make clang happy
Diffstat (limited to 'tests')
-rw-r--r--tests/track_lanes.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/track_lanes.lua b/tests/track_lanes.lua
index 7fd1d2e..32f579b 100644
--- a/tests/track_lanes.lua
+++ b/tests/track_lanes.lua
@@ -22,6 +22,11 @@ local track = function( title_, expected_count_)
22end 22end
23 23
24local sleeper = function( name_, seconds_) 24local sleeper = function( name_, seconds_)
25 -- no set_finalizer in main thread
26 if set_finalizer
27 then
28 set_finalizer(function() print("Finalizing '" .. name_ .. "'") end)
29 end
25 -- print( "entering '" .. name_ .. "'") 30 -- print( "entering '" .. name_ .. "'")
26 local lanes = require "lanes" 31 local lanes = require "lanes"
27 -- no set_debug_threadname in main thread 32 -- no set_debug_threadname in main thread
@@ -30,7 +35,7 @@ local sleeper = function( name_, seconds_)
30 -- print( "set_debug_threadname('" .. name_ .. "')") 35 -- print( "set_debug_threadname('" .. name_ .. "')")
31 set_debug_threadname( name_) 36 set_debug_threadname( name_)
32 end 37 end
33 -- suspend the lane for the specified duration with a failed linda read 38 -- suspend the lane for the specified duration
34 lanes.sleep(seconds_) 39 lanes.sleep(seconds_)
35 -- print( "exiting '" .. name_ .. "'") 40 -- print( "exiting '" .. name_ .. "'")
36end 41end
@@ -85,4 +90,9 @@ local threads = track( "============= AFTER COLLECTGARBAGE", 2)
85-- two_seconds #2 forever 90-- two_seconds #2 forever
86assert(threads[1].status == 'waiting' and threads[2].status == 'waiting') 91assert(threads[1].status == 'waiting' and threads[2].status == 'waiting')
87 92
88print "done" \ No newline at end of file 93-- wait a bit more for ephemeral2 to exit, so that we get to have a free-running lane terminate itself before shutdown
94SLEEP(3)
95
96print "============= AFTER WAITING"
97-- this is printed after Universe shutdown terminates the only remaining lane, 'forever'
98lanes.finally(function() print "TEST OK" end)