lua-users home
lua-l archive

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


That's rather outside the scope of Lua as an embeddable scripting
language, not to mention it would have some terrible overhead for the
most common use case of a single thread. It also can't be done in ANSI
C -- note that Python has the same restrictions to multithreading, but
it has platform-specific threading primitives in place as the Global
Interpreter Lock to avoid conflicts.

If you really want to see Lua with multithreading, take a look at Lanes.

/s/ Adam

On Thu, Jun 20, 2013 at 2:44 PM, kamicc olo <kamicc@gmail.com> wrote:
> I guess it would be easier and would make more sense building some
> message mechanism on C side to communicate between those separate
> threads and Lua VMs. Then in more or less distant future You wouldn't
> have to do a total rework to move to separate processes, separate CPUs
> or even separate REAL machines....
>
> On 6/21/13, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
>>> 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.
>>
>> The Lua VM does not use static variables but its data structures are not
>> thread-safe. For instance, two threads passing a string to the Lua VM
>> could mess with the string hash table.
>>
>>
>