[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Is it possible to run Lua threads in OS threads safely?
- From: Robert Virding <rvirding@...>
- Date: Sun, 14 Jun 2020 13:13:57 +0200
A slightly different solution if you want multi-threading would be to use Luerl
which runs on top of Erlang
/Elixir. It allows you to run multiple Luas each in its own Erlang process, however they cannot share data as the Erlang processes by design don't share. Erlang is of course a widely used system, you are most likely using systems which contain Erlang, and Luerl is also being commercially used.
Whether this is helpful depends, of course, on what your system does.
My name is James (Jim) Pascoe and I have been using Lua for around 18 months now. I absolutely love it - Lua's embeddability, speed and instant appeal to users has meant that Lua is becoming very popular in my company (Blu Wireless). Thank you for all your continued hard work.
Apologies if this has been answered before, but I would really appreciate some clarification on lua_newthread(). My understanding is that lua_newthread() provides a distinct execution stack, so you can have independent pieces of Lua code loaded and run by different Lua threads. Also, the reference manual states that Lua threads created by lua_newthread() share the same global environment, which (as I understand it) means that they point to the same global environment in the parent lua_State. However, what I am trying to understand is whether it is possible to run individual Lua threads in separate OS threads safely? And also, is it possible for Lua threads running in separate OS threads to communicate?
As I say, I would really appreciate some clarification on this from the community.
Thank you very much and have a good weekend,