diff --git a/Sources/NIO/Embedded.swift b/Sources/NIO/Embedded.swift index 2c0d9cec1..2f0ca6f13 100644 --- a/Sources/NIO/Embedded.swift +++ b/Sources/NIO/Embedded.swift @@ -61,7 +61,7 @@ public class EmbeddedEventLoop: EventLoop { public init() { } - public func scheduleTask(in: TimeAmount, _ task: @escaping () throws-> (T)) -> Scheduled { + public func scheduleTask(in: TimeAmount, _ task: @escaping () throws -> T) -> Scheduled { let promise: EventLoopPromise = newPromise() let readyTime = now + UInt64(`in`.nanoseconds) let task = EmbeddedScheduledTask(readyTime: readyTime) { diff --git a/Sources/NIO/EventLoop.swift b/Sources/NIO/EventLoop.swift index c5bfff6ba..609af972b 100644 --- a/Sources/NIO/EventLoop.swift +++ b/Sources/NIO/EventLoop.swift @@ -89,10 +89,10 @@ public protocol EventLoop: EventLoopGroup { /// - parameters: /// - task: The closure that will be submited to the `EventLoop` for execution. /// - returns: `EventLoopFuture` that is notified once the task was executed. - func submit(_ task: @escaping () throws-> (T)) -> EventLoopFuture + func submit(_ task: @escaping () throws -> T) -> EventLoopFuture /// Schedule a `task` that is executed by this `SelectableEventLoop` after the given amount of time. - func scheduleTask(in: TimeAmount, _ task: @escaping () throws-> (T)) -> Scheduled + func scheduleTask(in: TimeAmount, _ task: @escaping () throws -> T) -> Scheduled } /// Represents a time _interval_. @@ -165,13 +165,14 @@ extension TimeAmount: Comparable { public static func < (lhs: TimeAmount, rhs: TimeAmount) -> Bool { return lhs.nanoseconds < rhs.nanoseconds } + public static func == (lhs: TimeAmount, rhs: TimeAmount) -> Bool { return lhs.nanoseconds == rhs.nanoseconds } } extension EventLoop { - public func submit(_ task: @escaping () throws-> (T)) -> EventLoopFuture { + public func submit(_ task: @escaping () throws -> T) -> EventLoopFuture { let promise: EventLoopPromise = newPromise(file: #file, line: #line) self.execute { @@ -367,7 +368,7 @@ internal final class SelectableEventLoop: EventLoop { return thread.isCurrent } - public func scheduleTask(in: TimeAmount, _ task: @escaping () throws-> (T)) -> Scheduled { + public func scheduleTask(in: TimeAmount, _ task: @escaping () throws -> T) -> Scheduled { let promise: EventLoopPromise = newPromise() let task = ScheduledTask({ do { @@ -770,6 +771,7 @@ extension ScheduledTask: Comparable { public static func < (lhs: ScheduledTask, rhs: ScheduledTask) -> Bool { return lhs.readyTime < rhs.readyTime } + public static func == (lhs: ScheduledTask, rhs: ScheduledTask) -> Bool { return lhs === rhs }