Closed weissi closed 1 year ago
This cannot be merged until https://github.com/apple/swift-nio/pull/2471 has been released in NIO 2.57.0
With the NIO 2.58.0 release this should now go green
@Lukasa merging is currently blocked because it still has you down as a 'request changes', at your convenience PTAL
Motivation:
(companion PR to https://github.com/apple/swift-nio/pull/2471)
SwiftNIO allows and encourages to precisely manage all operating system resources like file descriptors & threads. That is a very important property of the system but in many places -- especially single Swift Concurrency arrived -- many simpler SwiftNIO programs only require a single, globally shared EventLoopGroup. Often even with just one thread.
Long story short: Many, probably most users would happily trade precise control over the threads for not having to pass around
EventLoopGroup
s. Today, many of those users resort to creating (and often leaking) threads because it's simpler. Adding singletons type which lazily provide a singletonEventLoopGroup
and anNIOThreadPool
is IMHO a much better answer.Modifications:
NIOTSEventLoopGroup.singleton
NIOSingletons.transportServicesEventLoopGroup
Result: