RE: Garbage collection thread synchronization
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: RE: Garbage collection thread synchronization
- From: "Joshua Jensen" <jjensen@...>
- Date: 2001年9月25日 23:10:51 -0600
> > Exactly what does it mean to "synchronize any write-access
> to its own
> > stack"?
>
> It means that a thread can write to its onw stack only when
> it has the lock. If it will only read the stack, it does not
> need the lock, as no other thread can write to that stack.
So if I have a callback:
static int MyCallback(lua_State* L)
{
lua_pushnumber(L, 5.0);
lua_pushstring(L, "fdsa");
return 2;
}
Is normal usage of lua_push*() enough, since internally,
lua_pushnumber() and lua_pushstring() call lua_lock()/lua_unlock()? Or
do I have to wrap it like?
static int MyCallback(lua_State* L)
{
lua_lock(L);
lua_pushnumber(L, 5.0);
lua_pushstring(L, "fdsa");
lua_unlock(L);
return 2;
}
Any help you can give here would be appreciated! :)
Thanks,
Josh