lua-users home
lua-l archive

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


>
> I work on Luvit and Luv and we store the ref then in the callback
> call the unref.
>
I also do that in my binding, but it prevents collect handles by Lua GC. I need to Lua calls gc method but until that I want be able find out Lua object by C handle.
The problem is that remove value from weak table and call finalizer is not atomic and there may be time when value removes from table and finalizer is not called yet.

Here my testcase
```Lua
uv.timer() -- put timer to weak table(handle=>Lua object)
assert(#uv.handles() == 1) -- use uv_walk to enumerate all handles
```
The problem is Lua GC remove timer from table but did not call __gc method and uv_walk's callback can not find Lua object.






---
Это сообщение проверено на вирусы антивирусом Avast.
http://www.avast.com