checkCorrectThread
Embedded.swift:141func checkCorrectThread()
func checkCorrectThread()
s11NIOEmbedded17EmbeddedEventLoopC18checkCorrectThreadyyF
What are these?3APDV
import NIOEmbedded
final class EmbeddedEventLoop
An EventLoop
that is embedded in the current running context with no external control.
init()
Initialize a new EmbeddedEventLoop
.
let description: String
var executor: any SerialExecutor { get }
var inEventLoop: Bool { get }
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)
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 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 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>
func shutdownGracefully(queue: DispatchQueue, _ callback: @escaping (Error?) -> Void)