CC: Tweaked

CC: Tweaked

57M Downloads

Real multitasking support/Multithreading support

nift4 opened this issue ยท 4 comments

commented

This is not breaking something because this isn't used by default, but I'm sure there are some great use cases like a real multitasking OS :)

commented

Coroutines are a very expressive control primitive and I'm sure you can figure something out, perhaps using the debug API as well. The event-driven, cooperative model works very well for practical applications of CC.

commented

Yes, of course, but it's still different than real multitasking

commented

What actual gain would adding preemptive (cooperative multitasking is just as "real" as preemptive multitasking) lead to? Because I can see several downsides, not the least of which is implementation complexity and additional maintainership burden.

commented

Lua is very much designed as a single-threaded VM, and as such lacks many of the concurrency primitives one would need (such as locks) for a sane multi-threaded system.

The cleanest solution would be to do something like Lua lanes, and allow running multiple separate processes which can pass messages to each other. However, there's an "easy" way to do that already - multiple computers!