lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 31.10.2023 um 10:43 schrieb bil til:
Am Di., 31. Okt. 2023 um 09:24 Uhr schrieb Thijs Schreijer
<thijs@thijsschreijer.nl>:

      

      
imho it should be dealt with on a Lua level. I actually discussed this with Roberto during the 2022 Lua workshop, and he had some ideas like a "goto" for coroutines. So hopefully we'll see this fixed in the next Lua version.

I would be surprised if this would work in Lua at all, as coroutines
in Lua are by principle cooperatively multitasking, not in "any
preemtive way"... .

(...)

... why Lua does not support pre-emptive multithreading is explained
very clearly in Roberto's book Programming in Lua... . I think he is
very correct and adding pre-emptive multithreading to Lua sound a bit
like a "Halloween proposal" to me, sorry.... . I am not a big friend
of pre-emptive multitasking, also not in Windows... . If you like
pre-emptive things so much, you can without problems start Lua on
different pre-emptive machines of your operating system (like e. g.
Windows...).

I don't think that a "yield_to" or something equivalent is the same as pre-emptive multitasking.
The yield will still be from a very specific point in code, the call to the function.
So actually if you are writing a script it doesn't change anything, as you already need to consider that in Lua any function can yield.
--

Thomas