Required Instance Methodswift-nio 2.72.0NIOCore
preconditionInEventLoop(file:line:)
Asserts that the current thread is the one tied to this EventLoop
. Otherwise, the process will be abnormally terminated as per the semantics of preconditionFailure(_:file:line:)
.
func preconditionInEventLoop(file: StaticString, line: UInt)
This method may never produce false positives or false negatives in conforming implementations. It may never terminate the process when event loop context is actually held, and it may never fail to terminate the process when event loop context is not held.
Other requirements
View members
Hide members
This section is hidden by default because it contains too many (12) members.
Instance members
var executor: any SerialExecutor
Returns a
SerialExecutor
corresponding to thisEventLoop
.var inEventLoop: Bool
Returns
true
if the currentNIOThread
is the same as theNIOThread
that is tied to thisEventLoop
.false
otherwise.func enqueue(consuming ExecutorJob
) Submit a job to be executed by the
EventLoop
func execute(@escaping () -> Void
) Submit a given task to be executed by the
EventLoop
func makeSucceededVoidFuture(
) -> EventLoopFuture<Void> Return a succeeded
Void
future.func preconditionNotInEventLoop(file: StaticString, line: UInt
) Asserts that the current thread is not the one tied to this
EventLoop
. Otherwise, the process will be abnormally terminated as per the semantics ofpreconditionFailure(_:file:line:)
.func scheduleTask<T>(deadline: NIODeadline, @escaping () throws -> T
) -> Scheduled<T> Schedule a
task
that is executed by thisEventLoop
at the given time.func scheduleTask<T>(in: TimeAmount, @escaping () throws -> T
) -> Scheduled<T> Schedule a
task
that is executed by thisEventLoop
after the given amount of time.func submit<T>(@escaping () throws -> T
) -> EventLoopFuture<T> Submit a given task to be executed by the
EventLoop
. Once the execution is complete the returnedEventLoopFuture
is notified.
Show implementation details (3)
Hide implementation details
func _preconditionSafeToWait(file: StaticString, line: UInt
) Must crash if it is not safe to call
wait()
on anEventLoopFuture
.func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier
) -> (file: StaticString, line: UInt)? Debug hook: complete a specific promise and return its creation location.
func _promiseCreated(futureIdentifier: _NIOEventLoopFutureIdentifier, file: StaticString, line: UInt
) Debug hook: track a promise creation and its location.
Citizens in NIOCore
Default implementations
func preconditionInEventLoop(file: StaticString, line: UInt
) Checks the necessary condition of currently running on the called
EventLoop
for making forward progress.