[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Garbage collection thread synchronization
- From: Roberto Ierusalimschy <rieru@...>
- Date: Tue, 25 Sep 2001 09:37:37 -0500 (CDT)
On Mon, 24 Sep 2001, Joshua Jensen wrote:
> In lstate.c, the following comment exists:
>
> ** macros for thread syncronization inside Lua core machine:
> ** all accesses to the global state and to global objects are
> syncronized.
> ** Because threads can read the stack of other threads
> ** (when running garbage collection),
> ** a thread must also syncronize any write-access to its own stack.
> ** Unsyncronized accesses are allowed only when reading its own stack,
> ** or when reading immutable fields from global objects
> ** (such as string values and udata values).
>
> 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.
-- Roberto