lua-users home
lua-l archive

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


All of the Lua data structures are shared across the threads and are subject
to a single garbage collector. The lua_States are all essentially portals
onto a shared Lua universe.

Mark

on 4/13/04 11:33 PM, Taj Khattra at taj.khattra@pobox.com wrote:

> On Tue, Apr 13, 2004 at 10:46:16PM -0700, Mark Hamburg wrote:
>> For preemptive C threads, what I'm currently doing is generating a lua_State
>> per C thread and using a single mutex managed by lua_lock and lua_unlock to
>> coordinate amongst them. This means that at most one thread can be actually
>> executing within the Lua universe at once.
> 
> i'm curious to know why you need lua_lock/lua_unlock if you have a
> distinct lua_State per C thread, since from the Lua core's point of
> view they shouldn't interfere - do they need to serialize access to
> some shared non lua_State state ?
> 
> thanks