Skip to content
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

Question: event hook on new_thread/new_work? #531

Open
wbthomason opened this issue Feb 17, 2021 · 2 comments
Open

Question: event hook on new_thread/new_work? #531

wbthomason opened this issue Feb 17, 2021 · 2 comments

Comments

@wbthomason
Copy link

Is there a way for embedders to get a callback on new_thread or new_work? This would be useful for for e.g. modifying _G in the thread's lua_State.

It seems as though #350 may already provide this, but I don't see a way to determine (in the lua_CFpcall callback) from where the callback has been called. Perhaps this could be a new flag, e.g. LUVF_CALLBACK_NEWTHREAD, indicating to the callback implementer that it should (if desired) perform initialization work on the provided lua_State?

@wbthomason
Copy link
Author

Also, just to note: I'd be happy to put together a PR for this if it seems like a desirable feature and a reasonable approach. I can also give more details on the motivation for the feature.

@shaunsingh
Copy link

Bumping this, Saw this issue earlier after some confusion about asynchronous code in neovim. It would be nice to have proper multithreading for those few tasks that really benefit from it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants