withCurrentThreadAsEventLoop(_:)
Convert the calling thread into an EventLoop
.
static func withCurrentThreadAsEventLoop(_ callback: @escaping (any EventLoop) -> Void)
Parameters
- callback
Called on the
EventLoop
that the calling thread was converted to, providing you theEventLoop
reference. Just like usually on theEventLoop
, do not block incallback
.
This function will not return until the EventLoop
has stopped. You can initiate stopping the EventLoop
by calling eventLoop.shutdownGracefully
which will eventually make this function return.