lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Benoit Germain wrote:
I suppose that when the script execution terminates, the main thread is collected, as should be the the still-running lane. However, the output becomes:

lua LanesBug.wlua
luaopen_xbdm: threadId = 2452
luaopen_xbdm: threadId = 3404
luaxbdm_gc: userdata threadId = 2452, current thread id = 2452

Where has the second __gc call gone?

If you have LuaSocket handy, try this:

require "lanes"
require "xbdm"
require "socket"

local function laneFunc()
 	require "xbdm"
	require "socket"

local lanegen = lanes.gen( "package", laneFunc)
local mylane = lanegen()

It should call __gc now. I think that in your example, the lanes are just terminated by the OS.