From e5298263ec8a999ac35f1797be91cfcba4e46a7d Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 16 Mar 2020 02:14:21 -0700 Subject: [PATCH] SelectableEventLoop: make Darwin the special case (#1449) Treat the `autoreleasepool` case for Darwin as the special case rather than Linux as the special case. This is following the case throughout the rest of the code base. This is also needed for the Windows port. --- Sources/NIO/SelectableEventLoop.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/NIO/SelectableEventLoop.swift b/Sources/NIO/SelectableEventLoop.swift index 35af41b88..37d547b33 100644 --- a/Sources/NIO/SelectableEventLoop.swift +++ b/Sources/NIO/SelectableEventLoop.swift @@ -18,13 +18,13 @@ import NIOConcurrencyHelpers /// Execute the given closure and ensure we release all auto pools if needed. @inlinable internal func withAutoReleasePool(_ execute: () throws -> T) rethrows -> T { - #if os(Linux) - return try execute() - #else +#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) return try autoreleasepool { try execute() } - #endif +#else + return try execute() +#endif } /// `EventLoop` implementation that uses a `Selector` to get notified once there is more I/O or tasks to process.