-
Been trying to debug a strange locking issue in send mode and found that mlua seems to hold a lock around lua across en entire Thread::resume call. Won't this lead to issues if another thread tries to perform operations on the lua VM while in a lua thread resume [aka, shouldnt mlua release the lock before the resume and then relock or am I not seeing it correctly] |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The main purpose of the lock is to protect Lua VM. If release the lock before |
Beta Was this translation helpful? Give feedback.
The main purpose of the lock is to protect Lua VM. If release the lock before
Thread::resume
call, then another thread waiting for the lock will acquire it, get access to the VM and can execute any operations. Such scenario is not supported by Lua and will cause UB.