lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The whole idea of lua_lock/lua_unlock is to control accesses among different
threads sharing the same global state. That means that all trheads should
use the same mutex.

So, your macros should be like

  #define LUA_USERSTATE CRITICAL_SECTION *cs;

where all LUA_USERSTATE would point to the same CRITICAL_SECTION
variable. That shared variable would be already locked when you first
resume a new thread.

(We could have defined a kind of LUA_GLOBALUSERSTATE in global_State,
but there would be no way to access it with an abstract lua_State.)

-- Roberto