From 44c617f7b756052c7cd059c96f89b85f0f5ec96c Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 3 Jun 2024 15:53:34 +0200 Subject: Moved lanes.sleep implementation to the C-side --- tests/cancel.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/cancel.lua b/tests/cancel.lua index b75d085..92ab439 100644 --- a/tests/cancel.lua +++ b/tests/cancel.lua @@ -10,8 +10,15 @@ end local lanes = require "lanes" .configure{ with_timers = false} local SLEEP = function(...) - local k, v = lanes.sleep(...) - assert(k == nil and v == "timeout") + -- just for fun: start a lane that will do the sleeping for us + local sleeperBody = function(...) + local lanes = require "lanes" + local k, v = lanes.sleep(...) + assert(k == nil and v == "timeout") + end + local sleeper = lanes.gen("*", sleeperBody)(...) + -- then wait for the lane to terminate + sleeper:join() end local linda = lanes.linda() -- cgit v1.2.3-55-g6feb