aboutsummaryrefslogtreecommitdiff
path: root/tests/recursive.lua
blob: 139f4c80d4bd2da03136d63424fddd7b59f30854 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--
-- RECURSIVE.LUA
--
-- Test program for Lua Lanes
--

io.stderr:write( "depth:" )
local function func( depth )
    io.stderr:write(" " .. depth)
    if depth > 10 then
        return "done!"
    end

    local lanes = require "lanes"
    -- lanes.configure() is available only at the first require()
    if lanes.configure then
			lanes = lanes.configure{with_timers = false}
		end
    local lane= lanes.gen("*", func)( depth+1 )
    return lane[1]
end

local v= func(0)
assert(v=="done!")
io.stderr:write("\n")