-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loop __gc is not set when luv_set_loop
is used.
#754
Comments
I think the right approach here might be exposing a When cleanup was moved into |
When setting up luv with luaopen_luv(), instead of cleaning up workers in the __gc of the loop (which luv may not own), instead create an empty userdata with a worker __gc and attach it to the lua_State. Fixes luvit#754
I opened #756 as an alternative to your suggestion. The idea is that the worker cleanup seems to be unrelated to the loop, so instead create an empty userdata with a |
When setting up luv with luaopen_luv(), instead of cleaning up workers in the __gc of the loop (which luv may not own), instead create an empty userdata with a worker __gc and attach it to the lua_State. Fixes luvit#754
It just occurred to me that having work cleanup attached to Such a case is highly unlikely, and I'm really not sure there's a correct solution to that one for luv in general because we also have to be able to support Lua just |
When setting up luv with luaopen_luv(), instead of cleaning up workers in the __gc of the loop (which luv may not own), instead create an empty userdata with a worker __gc and attach it to the lua_State. Fixes luvit#754
When setting up luv with luaopen_luv(), instead of cleaning up workers in the __gc of the loop (which luv may not own), instead create an empty userdata with a worker __gc and attach it to the lua_State. Fixes luvit#754
I'm not sure if |
I had a slightly crazy idea that may work. We could move the list of work vms entirely into a a userdata so that this issue just doesn't exist at all. That way even threads get their own work vms that they can clean up separately. |
Neovim sets up luv via:
Note here, Neovim uses
lua_set_loop
when setting up the main thread.However, #742 has revealed that if
luv_set_loop
is used, then the_gc
metamethod (which points toloop_gc
) is never applied due to a NULL check. See here.In the past this was fine as Neovim had it's own loop closing logic, however #742 moved the thread cleaning logic into this
__gc
method. This code is private and Neovim has no way of calling it in its own loop closing code.The text was updated successfully, but these errors were encountered: