If I follow approach 2 (have my own semaphore also I do lock/unlock while accessing lua state), will there be any issue.
I do not see any issue as out of two threads only one thread will be accessing lua state.
Now, my doubt is, when garbage collection happens, it executes in which thread context.
Since lua_lock and lua_unlock is not defined, can it cause any issue during garbage collection.
Out of two approaches, if I prefer approach 1, will it more slower.