Skip to content

Instantly share code, notes, and snippets.

@nights99
Created October 19, 2021 19:20
Show Gist options
  • Save nights99/bb1ed68e19f5d3711a475aef3cd70b28 to your computer and use it in GitHub Desktop.
Save nights99/bb1ed68e19f5d3711a475aef3cd70b28 to your computer and use it in GitHub Desktop.
MultiThreadedEventLoopGroup.withCurrentThreadAsEventLoop { el in
let fut = el.scheduleTask(in: .seconds(1), {() throws -> Bool in print("Foo");return true;})
fut.futureResult.whenComplete { (result: Result<Bool, Error>) -> Void in
el.shutdownGracefully { error in
print(error)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment