lua-users home
lua-l archive

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


>>lua LanesBug.wlua
> luaopen_xbdm: threadId = 4596
> luaopen_xbdm: threadId = 1836
> luaxbdm_gc: userdata threadId = 1836, current thread id = 4596
> luaxbdm_gc: userdata threadId = 4596, current thread id = 4596

Even more curious: Let's say I change the script like so (infinite loop in the lane function, and no lane join)

require "lanes"
require "xbdm" -- causes xbdm init -> CoInitialize in main thread

local function laneFunc()
	require "xbdm" -- causes xbdm init -> CoInitialize in lane thread
	while true do end
end

local lanegen = lanes.gen( "package", laneFunc)
local mylane = lanegen() -- lane thread starts -> xbdm required -> CoInitialize called in lane thread
for i = 1, 100000000 do end

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?