Lua operations, that works in mutitheaded environment
Posted
by
SBKarr
on Stack Overflow
See other posts from Stack Overflow
or by SBKarr
Published on 2012-10-09T15:09:53Z
Indexed on
2012/10/09
15:37 UTC
Read the original article
Hit count: 177
multithreading
|lua
My application uses Lua in multithreaded environment with global mutex. It implemented like this:
- Thread locks mutex,
- Call
lua_newthread
- Perform some initialization on
coroutine
- Run
lua_resume
oncoroutine
- Unlocks mutex
lua_lock/unlock
is not implemented, GC is stopped, when lua works with coroutine
.
My question is, can I perform steps 2 and 3 without locking, if initialisation process does not requires any global Lua structs? Can i perform all this process without locking at all, if coroutine
does not requires globals too?
In what case I generally can use Lua functions without locking?
© Stack Overflow or respective owner