[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: problem with lua_resume/lua_lock
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 07 Aug 2002 11:51:14 -0300
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