shutdownGracefully(queue:_:)
Embedded.swift:310func shutdownGracefully(queue: DispatchQueue, _ callback: @escaping (Error?) -> Void)
see:
EventLoop.shutdownGracefully
func shutdownGracefully(queue: DispatchQueue, _ callback: @escaping (Error?) -> Void)
s11NIOEmbedded17EmbeddedEventLoopC18shutdownGracefully5queue_y8Dispatch0H5QueueC_ys5Error_pSgctF
What are these?1P0FT
see: EventLoop.shutdownGracefully
import NIOEmbedded
final class EmbeddedEventLoop
An EventLoop
that is embedded in the current running context with no external control.
class DispatchQueue
protocol Error : Sendable
A type representing an error value that can be thrown.
typealias Void = ()
The return type of functions that don’t explicitly specify a return type, that is, an empty tuple ()
.
init()
Initialize a new EmbeddedEventLoop
.
let description: String
var executor: any SerialExecutor { get }
var inEventLoop: Bool { get }
var now: NIODeadline { get }
The current “time” for this event loop. This is an amount in nanoseconds.
func _executeIsolatedUnsafeUnchecked(_ task: @escaping () -> Void)
func _preconditionSafeToSyncShutdown(file: StaticString, line: UInt)
func _preconditionSafeToWait(file: StaticString, line: UInt)
func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier) -> (file: StaticString, line: UInt)?
func _promiseCreated(futureIdentifier: _NIOEventLoopFutureIdentifier, file: StaticString, line: UInt)
@discardableResult func _scheduleTaskIsolatedUnsafeUnchecked<T>(deadline: NIODeadline, _ task: @escaping () throws -> T) -> Scheduled<T>
@discardableResult func _scheduleTaskIsolatedUnsafeUnchecked<T>(in delay: TimeAmount, _ task: @escaping () throws -> T) -> Scheduled<T>
func _submitIsolatedUnsafeUnchecked<T>(_ task: @escaping () throws -> T) -> EventLoopFuture<T>
func advanceTime(by increment: TimeAmount)
Runs the event loop and moves “time” forward by the given amount, running any scheduled tasks that need to be run.
func advanceTime(to deadline: NIODeadline)
Runs the event loop and moves “time” forward to the given point in time, running any scheduled tasks that need to be run.
func checkCorrectThread()
func execute(_ task: @escaping () -> Void)
On an EmbeddedEventLoop
, execute
will simply use scheduleTask
with a deadline of now. This means that task
will be run the next time you call EmbeddedEventLoop.run
.
func preconditionInEventLoop(file: StaticString, line: UInt)
func preconditionNotInEventLoop(file: StaticString, line: UInt)
func run()
Run all tasks that have previously been submitted to this EmbeddedEventLoop
, either by calling execute
or events that have been enqueued using scheduleTask
/scheduleRepeatedTask
/scheduleRepeatedAsyncTask
and whose deadlines have expired.
@discardableResult @preconcurrency func scheduleCallback(in amount: TimeAmount, handler: some (NIOScheduledCallbackHandler & Sendable)) -> NIOScheduledCallback
@discardableResult func scheduleTask<T>(deadline: NIODeadline, _ task: @escaping () throws -> T) -> Scheduled<T>
@discardableResult func scheduleTask<T>(in: TimeAmount, _ task: @escaping () throws -> T) -> Scheduled<T>