lua-users home
lua-l archive

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


i.e. they were created using lua_newthread, <not> lua_open (except for the
first one of course).

Anyone following along and still confused as to why the lua_States need
protection from one another, should now be able to look this up. :-)

Mark correct me if my guess is wrong.

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of Mark Hamburg
Sent: Wednesday, April 14, 2004 12:05 PM
To: Lua list
Subject: Re: once again, cooperative multitasking?


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