Static Methodswift-nio 2.72.0NIOPosix
withCurrentThreadAsEventLoop(_:)
Convert the calling thread into an EventLoop
.
static func withCurrentThreadAsEventLoop(_ callback: @escaping (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.
Other members in extension
Type members
init(numberOfThreads: Int
) Creates a
MultiThreadedEventLoopGroup
instance which usesnumberOfThreads
.init(numberOfThreads: Int, metricsDelegate: NIOEventLoopMetricsDelegate
) Creates a
MultiThreadedEventLoopGroup
instance which usesnumberOfThreads
.static var currentEventLoop: EventLoop?
Returns the
EventLoop
for the calling thread.static var singleton: MultiThreadedEventLoopGroup
A globally shared, singleton
MultiThreadedEventLoopGroup
.
Show implementation details (1)
Hide implementation details
static func _makePerpetualGroup(threadNamePrefix: String, numberOfThreads: Int
) -> MultiThreadedEventLoopGroup Create a
MultiThreadedEventLoopGroup
that cannot be shut down and must not bedeinit
ed.
Instance members
var description: String
func any(
) -> EventLoop Returns the current
EventLoop
if we are on anEventLoop
of thisMultiThreadedEventLoopGroup
instance.func makeIterator(
) -> EventLoopIterator Returns an
EventLoopIterator
over theEventLoop
s in thisMultiThreadedEventLoopGroup
.func next(
) -> EventLoop Returns the next
EventLoop
from thisMultiThreadedEventLoopGroup
.func shutdownGracefully(queue: DispatchQueue, @escaping (Error?) -> Void
) Shut this
MultiThreadedEventLoopGroup
down which causes theEventLoop
s and their associated threads to be shut down and release their resources.