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

Fix async #729

Closed
wants to merge 12 commits into from
Closed

Conversation

javalikescript
Copy link
Contributor

@javalikescript javalikescript commented Nov 4, 2024

Adds a reference count to async enabling to pass it properly as thread/async argument.
Protects async arg using a mutex and defer clear to GC.
Copy async arguments rather than using Lua ref.

Fix #505
Fix passing an async as async send argument then use it outside the callback function
Fix suspect pop, here
Fix thread join after exited

This PR attempts to keep the async/thread behavior, except for setting the userdata metadata in the async callback and passing empty userdata as light userdata.
It may not be the best solution as it results in rather conplex and messy code.

@javalikescript javalikescript marked this pull request as draft November 7, 2024 07:02
@javalikescript javalikescript changed the title Fix async GC Fix async Nov 7, 2024
@javalikescript
Copy link
Contributor Author

Using a reference count is not enough, the async handle from another thread should have a specific behavior such as dedicated GC and close methods.
I put this fix on hold looking for a simpler solution.

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

Successfully merging this pull request may close these issues.

memory leak related to uv.send_async
1 participant