mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Motivation: As we break apart NIO, it's a bit awkward that EventLoopFuture.wait knows about two specific EventLoop implementations. It does this in order to detect deadlocks, so we should try to preserve the capability as best as possible. Modifications: - Add EventLoop._preconditionSafeToWait, which can reproduce much of the logic currently in EventLoopFuture.wait(). - Provide implementations for SelectableEventLoop and EmbeddedEventLoop. Result: Partial reproduction of the current behaviour of EventLoopFuture.wait(). Unfortunately this cannot completely reimplement this behaviour, as we cannot safely call MultiThreadedEventLoopGroup.currentEventLoop for all event loops. This is as close as we can safely get without breaking the abstraction boundary, sadly.