[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua in a threaded enviroment
- From: Russell Haley <russ.haley@...>
- Date: Tue, 30 Aug 2016 15:08:35 -0700
This library can take advantage of Unix threads, domain sockets,
polling, events, kqueue and pretty much any other Unix C api that a
developer could want. Just don't expect anything from the author. I
was told in no uncertain terms this library is for those already
initiated in the ways of Unix C.
On Sun, Aug 28, 2016 at 2:57 AM, Marc Balmer <email@example.com> wrote:
> Does someone on this list have experience with running Lua in a threaded environment?
> I am thinking about the following scenario:
> - A main thread creates a Lua state and uses it the usual way using the C API.
> - A secondary thread should call a function in said Lua state from time to time,
> asynchronously and not predictable when it will do so. Totally independent from
> the main thread.
> It's obvious that this will not work and that some sort of arbitration will be needed. As
> I understand, there is no locking at all in Lua, and not even a function to query if a
> Lua state is currently executing Lua code, i.e. if another thread is running the Lua
> What's the best approach to this? I think I will have to add a locking mechanism
> and aquire the lock before calling any of the Lua C API functions. Are there better