Closed Isaac-Leonard closed 2 years ago
Correct, this is how it will work. We would be using the "task stealing queue" strategy from Go and Tokio.
Basically each thread will have an event queue and the tasks will be shuffled around to ensure all the cores are working on tasks.
We target threads and package them into queues, that way the event loop is a library and not a built-in construct.
https://github.com/alshdavid/BorrowScript#concurrency-async--await
In the main README file there's a brief discussion of how the event queue would work with threads. Can I suggest that each thread is given its own event queue and then is given functions to explicitly flush it so that synchronous code can use it without needing to add awaits and promises?