The module LC.mutex
provides so-called „mutexes“ to synchronize multiple Lua threads.
LC.mutex.
debug
(enable)¶
enable (Boolean) – enable/disable debug logging
Enable or disable debugging of mutex operations. With debugging enabled, every call of LC.mutex.lock()
and LC.mutex.unlock()
will be logged (using LC.log.print()
).
LC.mutex.
lock
(name)¶
name (String) – mutex name
Lock the mutex named mutex
. If no mutex exists with that name, a new one is created automatically.
LC.mutex.
unlock
(name)¶
name (String) – mutex name
Release the lock for the mutex named mutex
. That mutex must have been locked before, otherwise undefined errors may occur.