diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-03 15:53:34 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-03 15:53:34 +0200 |
commit | 44c617f7b756052c7cd059c96f89b85f0f5ec96c (patch) | |
tree | a9ac504d7ffa09500c9ea17bab963f1016f6fe79 /tests | |
parent | 420e50697cd036a0d8ea1601961bd6974703ade1 (diff) | |
download | lanes-44c617f7b756052c7cd059c96f89b85f0f5ec96c.tar.gz lanes-44c617f7b756052c7cd059c96f89b85f0f5ec96c.tar.bz2 lanes-44c617f7b756052c7cd059c96f89b85f0f5ec96c.zip |
Moved lanes.sleep implementation to the C-side
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cancel.lua | 11 |
1 files changed, 9 insertions, 2 deletions
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 | |||
10 | local lanes = require "lanes" .configure{ with_timers = false} | 10 | local lanes = require "lanes" .configure{ with_timers = false} |
11 | 11 | ||
12 | local SLEEP = function(...) | 12 | local SLEEP = function(...) |
13 | local k, v = lanes.sleep(...) | 13 | -- just for fun: start a lane that will do the sleeping for us |
14 | assert(k == nil and v == "timeout") | 14 | local sleeperBody = function(...) |
15 | local lanes = require "lanes" | ||
16 | local k, v = lanes.sleep(...) | ||
17 | assert(k == nil and v == "timeout") | ||
18 | end | ||
19 | local sleeper = lanes.gen("*", sleeperBody)(...) | ||
20 | -- then wait for the lane to terminate | ||
21 | sleeper:join() | ||
15 | end | 22 | end |
16 | 23 | ||
17 | local linda = lanes.linda() | 24 | local linda = lanes.linda() |