Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasa committed Jan 23, 2025
1 parent c725bb1 commit 577537a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/NIOPosix/NIOThreadPool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,17 @@ extension NIOThreadPool {
/// - body: The closure which performs some blocking work to be done on the thread pool.
/// - Returns: The `EventLoopFuture` of `promise` fulfilled with the result (or error) of the passed closure.
@preconcurrency
public func runIfActive<T: Sendable>(eventLoop: EventLoop, _ body: @escaping @Sendable () throws -> T) -> EventLoopFuture<T> {
public func runIfActive<T: Sendable>(
eventLoop: EventLoop,
_ body: @escaping @Sendable () throws -> T
) -> EventLoopFuture<T> {
self._runIfActive(eventLoop: eventLoop, body)
}

private func _runIfActive<T: Sendable>(eventLoop: EventLoop, _ body: @escaping @Sendable () throws -> T) -> EventLoopFuture<T> {
private func _runIfActive<T: Sendable>(
eventLoop: EventLoop,
_ body: @escaping @Sendable () throws -> T
) -> EventLoopFuture<T> {
let promise = eventLoop.makePromise(of: T.self)
self.submit { shouldRun in
guard case shouldRun = NIOThreadPool.WorkItemState.active else {
Expand Down

0 comments on commit 577537a

Please sign in to comment.