From ffedd175233975f3ca9ac940df9883898d5ace25 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 3 Jul 2024 13:21:45 +0200 Subject: Renamed set_debug_threadname → lane_threadname (can also read the current name now) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/basic.lua | 12 ++++++------ tests/cancel.lua | 2 +- tests/deadlock.lua | 2 +- tests/fibonacci.lua | 4 ++-- tests/track_lanes.lua | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/basic.lua b/tests/basic.lua index 97783cb..f44c75f 100644 --- a/tests/basic.lua +++ b/tests/basic.lua @@ -76,7 +76,7 @@ end PRINT("\n\n", "---=== Tasking (basic) ===---", "\n\n") local function task(a, b, c) - set_debug_threadname("task("..a..","..b..","..c..")") + lane_threadname("task("..a..","..b..","..c..")") --error "111" -- testing error messages assert(hey) local v=0 @@ -329,7 +329,7 @@ SLEEP(1) PRINT("\n\n", "---=== Stdlib naming ===---", "\n\n") local function dump_g(_x) - set_debug_threadname "dump_g" + lane_threadname "dump_g" assert(print) print("### dumping _G for '" .. _x .. "'") for k, v in pairs(_G) do @@ -339,7 +339,7 @@ local function dump_g(_x) end local function io_os_f(_x) - set_debug_threadname "io_os_f" + lane_threadname "io_os_f" assert(print) print("### checking io and os libs existence for '" .. _x .. "'") assert(io) @@ -348,7 +348,7 @@ local function io_os_f(_x) end local function coro_f(_x) - set_debug_threadname "coro_f" + lane_threadname "coro_f" assert(print) print("### checking coroutine lib existence for '" .. _x .. "'") assert(coroutine) @@ -388,7 +388,7 @@ PRINT("\n\n", "---=== Comms criss cross ===---", "\n\n") -- local tc= lanes_gen("io", {gc_cb = gc_cb}, function(linda, ch_in, ch_out) - set_debug_threadname("criss cross " .. ch_in .. " -> " .. ch_out) + lane_threadname("criss cross " .. ch_in .. " -> " .. ch_out) local function STAGE(str) io.stderr:write(ch_in..": "..str.."\n") linda:send(nil, ch_out, str) @@ -488,7 +488,7 @@ PRINT("\n\n", "---=== :join test ===---", "\n\n") local S= lanes_gen("table", {gc_cb = gc_cb}, function(arg) - set_debug_threadname "join test lane" + lane_threadname "join test lane" set_finalizer(function() end) aux= {} for i, v in ipairs(arg) do diff --git a/tests/cancel.lua b/tests/cancel.lua index 1724e6a..9ee986c 100644 --- a/tests/cancel.lua +++ b/tests/cancel.lua @@ -75,7 +75,7 @@ end local laneBody = function( mode_, payload_) local name = "laneBody("..tostring(mode_)..","..tostring(payload_)..")" - set_debug_threadname( name) + lane_threadname(name) set_finalizer( function( err, stk) if err == lanes.cancel_error then diff --git a/tests/deadlock.lua b/tests/deadlock.lua index bbbda8d..d028e83 100644 --- a/tests/deadlock.lua +++ b/tests/deadlock.lua @@ -22,7 +22,7 @@ if do_extra_stuff then -- lane generator. don't initialize "io" base library so that it is not known in the lane local g = lanes.gen('base,table', function() - set_debug_threadname( "deadlock_lane") + lane_threadname( "deadlock_lane") -- wrapping inside pcall makes the Lanes module unaware that something went wrong print( "In lane 1:", table_unpack{ pcall( linda.receive, linda, 'tmp')}) -- with the bug not fixed, and non-recursive mutexes, we can hang here diff --git a/tests/fibonacci.lua b/tests/fibonacci.lua index 51e7137..7885ae6 100644 --- a/tests/fibonacci.lua +++ b/tests/fibonacci.lua @@ -24,14 +24,14 @@ end local KNOWN= { [0]=0, 1,1,2,3,5,8,13,21,34,55,89,144 } -- dummy function so that we don't error when fib() is launched from the master state -set_debug_threadname = function ( ...) +lane_threadname = function ( ...) end -- -- uint= fib( n_uint ) -- local function fib( n ) - set_debug_threadname( "fib(" .. n .. ")") + lane_threadname( "fib(" .. n .. ")") local lanes = require"lanes" -- local sum diff --git a/tests/track_lanes.lua b/tests/track_lanes.lua index 32f579b..803fae5 100644 --- a/tests/track_lanes.lua +++ b/tests/track_lanes.lua @@ -29,11 +29,11 @@ local sleeper = function( name_, seconds_) end -- print( "entering '" .. name_ .. "'") local lanes = require "lanes" - -- no set_debug_threadname in main thread - if set_debug_threadname + -- no lane_threadname in main thread + if lane_threadname then - -- print( "set_debug_threadname('" .. name_ .. "')") - set_debug_threadname( name_) + -- print( "lane_threadname('" .. name_ .. "')") + lane_threadname( name_) end -- suspend the lane for the specified duration lanes.sleep(seconds_) -- cgit v1.2.3-55-g6feb