[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: releasing callback on GC
- From: Gaspard Bucher <gaspard@...>
- Date: Mon, 3 Jan 2011 01:31:31 +0100
Hi there,
This is a difficult one: I have an OS thread that keeps hold of a function in lua with luaL_ref(L, LUA_REGISTRYINDEX). But the OS thread is created in Lua:
thread = rk.Thread(function()
-- do this and that
end
After some time, the thread is garbage collected.
How can I remove the function from the registry ? I cannot call luaL_unref in the rk.Thread destructor (segfault).
Do I need to hold it in the first place ? What about the thread created with lua_newthread ?
Gaspard