From aebf387be8c2479cf0e6dfe1d9fd3b214a32ce18 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Mon, 26 Mar 2018 13:03:32 +0200 Subject: [PATCH] Remove #available(OSX 10.12, *) check which is not needed anymore Motivation: At some point we needed to check for #available(OSX 10.12, *) which is not true anymore as we use our own Thread impl. Modifications: Remove #available(OSX 10.12, *) check Result: Remove incorrect and not needed check. --- Sources/NIO/EventLoop.swift | 42 +++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/Sources/NIO/EventLoop.swift b/Sources/NIO/EventLoop.swift index ee9af0f3aa4..1b6bcd63136 100644 --- a/Sources/NIO/EventLoop.swift +++ b/Sources/NIO/EventLoop.swift @@ -658,32 +658,28 @@ final public class MultiThreadedEventLoopGroup: EventLoopGroup { /* synchronised by `lock` */ var _loop: SelectableEventLoop! = nil - if #available(OSX 10.12, *) { - loopUpAndRunningGroup.enter() - Thread.spawnAndRun(name: name) { t in - initializer(t) - - do { - /* we try! this as this must work (just setting up kqueue/epoll) or else there's not much we can do here */ - let l = try! SelectableEventLoop(thread: t) - threadSpecificEventLoop.currentValue = l - defer { - threadSpecificEventLoop.currentValue = nil - } - lock.withLock { - _loop = l - } - loopUpAndRunningGroup.leave() - try l.run() - } catch let err { - fatalError("unexpected error while executing EventLoop \(err)") + loopUpAndRunningGroup.enter() + Thread.spawnAndRun(name: name) { t in + initializer(t) + + do { + /* we try! this as this must work (just setting up kqueue/epoll) or else there's not much we can do here */ + let l = try! SelectableEventLoop(thread: t) + threadSpecificEventLoop.currentValue = l + defer { + threadSpecificEventLoop.currentValue = nil } + lock.withLock { + _loop = l + } + loopUpAndRunningGroup.leave() + try l.run() + } catch let err { + fatalError("unexpected error while executing EventLoop \(err)") } - loopUpAndRunningGroup.wait() - return lock.withLock { _loop } - } else { - fatalError("Unsupported platform / OS version") } + loopUpAndRunningGroup.wait() + return lock.withLock { _loop } } /// Creates a `MultiThreadedEventLoopGroup` instance which uses `numThreads`.