Re: recognizing whether a caller uses function result
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: recognizing whether a caller uses function result
- From: Sean Conner <sean@...>
- Date: 2023年2月23日 02:35:19 -0500
It was thus said that the Great bil til once stated:
> >@ Sean:
> > Single-threaded code is easier to reason about. But one can make Lua
> > multi-threaded (as in, operating system level threads), but you will have to
> > implement the functions lua_lock() and lua_unlock() to generate a custom Lua
> > engine.
> This is not correct, I have a nice multithreading environment
> meanwhile running, all based on one base state with "tasks" (=threads)
> which can be created nicely by the user (I used a special task library
> for this, not the Lua coroutine library).
So you share a single Lua state among multiple operating system level
threads? Or are you talking about Lua coroutines? The former (operating
system threads, like pthreads under Linux) sharing a single Lua state
require the implementation of lua_lock() and lua_unlock().
-spc