When must I provide a self-defined lua_lock macro(e.g: #define lua_lock(L) pthread_lock(&mutex))?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: When must I provide a self-defined lua_lock macro(e.g: #define lua_lock(L) pthread_lock(&mutex))?
- From: 孙世龙 sunshilong <sunshilong369@...>
- Date: 2021年1月28日 17:17:02 +0800
Hi, list
In general, the macro named lua_lock is expanded as a
no-operation(i.e (void)0).
Here is the related code snippet in Lua-5.3.5:
/*
** macros that are executed whenever program enters the Lua core
** ('lua_lock') and leaves the core ('lua_unlock')
*/
#if !defined(lua_lock)
#define lua_lock(L) ((void) 0)
#define lua_unlock(L) ((void) 0)
#endif
I wonder when I need to provide a self-defined macro (e.g:
#define lua_lock(L) pthread_lock(&mutex))?
I would appreciate it if you could shed some light on this question.
Best regards
sunshilong