Victor:
On Tue, May 21, 2019 at 1:43 PM Victor Bombi <sonoro@telefonica.net> wrote:
> So thats even better: Just start a different interpreter in each OS thread (as is recommended in so many places) and concurrency problems will be gone away.
Your top-quoting is making following your thoughts difficult for me. I
DO NOT WANT an interpreter per thread. I want a single interpreter
with a couple hundreds, maybe a thousand, coroutines inside, doing
things in a simple way because they know they are the only one
running. But sometimes they may reenter from another thread.
Regards.
Francisco Olarte.
I am confused what the gain is of running them on other threads if you have to lock the main object (the Lua state). Wouldn't you end up with 99% of critical path inside mutexes and thus gain nothing from threading it since each task will be blocking on the next? (and if the answer is 'no, because the tasks do more than the lua access - wouldn't a message queue to the main thread suffice?).
If not, can critical data be stored in a blackboard-like structure or transactional memory?