Re: Parallel processes: multi-core, same CPU?

Benoit Germain <[email protected]> Sun, 14 Jun 2026 18:10:56 +0200
Newsgroups gmane.comp.lang.lua.general
Message-ID <CAAnJQcayAKt2iyDpj0OM+JW6GHfn9NBE5F=qgLmFY1L1zt2OXA@mail.gmail.com>
Le dim. 14 juin 2026 à 16:22, 'TopchetoEU' via lua-l <[email protected]>
a écrit :

> This is a known limitation with lua - you can't run two lua threads (under
> the same lua_State) in parallel. AFAIK lua allows you to define some
> locking primitives, but they only serve to lock the current lua_State while
> lua code is executing, so in effect, only one lua thread is really
> executing at a time.
>
> Your best bet is to create one lua_State per OS thread and device some
> kind of communication protocol between different lua states (since two
> states cannot share tables).
>

Shameless plug: one option is https://github.com/LuaLanes/lanes (there are
others, but they can publicize themselves :-)).

--
Benoit.

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAAnJQcayAKt2iyDpj0OM%2BJW6GHfn9NBE5F%3DqgLmFY1L1zt2OXA%40mail.gmail.com.