mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
* Support NIO Event Loops as actor executors Motivation Swift Concurrency supports having actors opt in to executing within a "custom executor". This requires being able to be strictly serial, a constraint that NIO's EventLoops natively meet. It is useful to have actors be able to express a "tie" to an EventLoop in order to efficiently access objects that are tied to specific ELs. Modifications - Extend EventLoop to expose an executor property - Provide a simple best-effort default using NIODefaultSerialEventLoopExecutor - Expose NIOSerialEventLoopExecutor protocol that makes it easy for adopters to get a better implementation - Crash if EmbeddedEventLoop is used - Add tests Result Adopters can use ELs as serial executors * Prefer #if compiler