Ladybird Browser - Event Loop integration with Swift Concurrency

Hi Andrew!
Thanks for taking the chat to the forums :waving_hand:

It's really exciting to see you dig into the possibilities here. Thanks for all the background info, it helps paint a general picture of what you're trying to do.

Yeah I think you're on the right track that your event loops are good candidates to become Executors (Serial - those who back actors mutual exclusion guarantees, or TaskExecutors);

It does sound like perhaps taking over both the global and main executors would give you some way to stick all the work to one of your event loops. And others, you'd perhaps use tasks with task executor preference to execute a task and all its child tasks on a specific event loop maybe? You might be interested in the [Pitch 2] Custom Main and Global Executors proposal which would allow you to effectively disable (or side step) any of Swift's existing executors, and therefore not have any threads that are not managed by your runtime.

Then the actual modeling of your queues and sending between them I'm not entirely sure... but as far as threading and isolation goes in general actor isolation so the "actor owns some data and only Sendable conforming types can be sent to other actors (isolation domains)" may be what may be helpful to you.

We discussed your PoC executor on chat, it seems like a good first step! Let us know when you hit maybe some specific issues and we can try to figure out how to model them in Swift then :thinking:

1 Like