diff options
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() |