[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Random crashed with threaded application
- From: Coda Highland <chighland@...>
- Date: Thu, 20 Jun 2013 14:23:18 -0700
On Thu, Jun 20, 2013 at 2:07 PM, David Demelier
> 2013/6/20 Javier Guerra Giraldez <firstname.lastname@example.org>:
>> On Thu, Jun 20, 2013 at 3:28 PM, Javier Guerra Giraldez
>> <email@example.com> wrote:
>>> you should read/modify/execute a single Lua State concurrently from two threads
>> ... and of course, by "you should..." i really meant "you should NOT...."
> So does the Lua VM store some static variables or so? Why it's not
> supported? My naive thoughts let me understand that if I use the state
> and leave it just like when I found it, it should continue working.
> Also, I didn't read something about thread issue in my PiL third
> edition, may be a notice should be added to the next book?
> Demelier David
The Lua code is reentrant, but not threadsafe. If you have multiple
Lua states running on separate threads, they'll run just fine, but if
you use ONE Lua state on MULTIPLE threads, you have to make sure that
only one thread is ever in the Lua internals at the same time.