[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Is it possible to run Lua threads in OS threads safely?
- From: Oliver <oschmidt-mailinglists@...>
- Date: Sat, 13 Jun 2020 23:23:10 +0200
On 13.06.20 20:16, Joseph C. Sible wrote:
> On Sat, Jun 13, 2020 at 2:05 PM James Pascoe <email@example.com> wrote:
>> what I am trying to understand is whether it is possible to run individual Lua threads in separate OS threads safely?
>> No, that's not possible to safely do with stock Lua. Different OS
>> And also, is it possible for Lua threads running in separate OS threads to communicate?
> On their own, separate Lua states can't communicate at all. You'd have
> to use some kind of helper to communicate between them, like Lua Lanes
>  or luaproc .
you also might be interested to have a look at
- lua-llthreads2  - Low-Level threads for Lua
- mtmsg  - Low-level message buffers for inter-thread communication
- mtstates  - Pass Lua states to other threads
- mtint  - Make threads and coroutines interruptible
These are orthogonal and low level cross platform packages that can be combined
and play well together. IMHO they build a simple and minimal base for building
higher level multi threading constructs in pure Lua.