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.
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.
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.