var executor: any SerialExecutor
func any() -> EventLoop
An EventLoop
forms a singular EventLoopGroup
, returning itself as ‘any’ EventLoop
.
func assertInEventLoop(file: StaticString, line: UInt)
Asserts that the current thread is the one tied to this EventLoop
. Otherwise, if running in debug mode, the process will be abnormally terminated as per the semantics of preconditionFailure(_:file:line:)
. Never has any effect in release mode.
func assertNotInEventLoop(file: StaticString, line: UInt)
Asserts that the current thread is not the one tied to this EventLoop
. Otherwise, if running in debug mode, the process will be abnormally terminated as per the semantics of preconditionFailure(_:file:line:)
. Never has any effect in release mode.
func cancelScheduledCallback(NIOScheduledCallback)
Default implementation of cancelScheduledCallback(_:)
: only cancels callbacks scheduled by the default implementation of scheduleCallback
.
func close() throws
Close this EventLoop
.
func enqueue(consuming ExecutorJob)
func flatScheduleTask<T>(deadline: NIODeadline, file: StaticString, line: UInt, @escaping () throws -> EventLoopFuture<T>) -> Scheduled<T>
Schedule a task
that is executed by this EventLoop
at the given time.
func flatScheduleTask<T>(in: TimeAmount, file: StaticString, line: UInt, @escaping () throws -> EventLoopFuture<T>) -> Scheduled<T>
Schedule a task
that is executed by this EventLoop
after the given amount of time.
func flatSubmit<T>(@escaping () -> EventLoopFuture<T>) -> EventLoopFuture<T>
Submit task
to be run on this EventLoop
.
func makeCompletedFuture<Success>(Result<Success, Error>) -> EventLoopFuture<Success>
Creates and returns a new EventLoopFuture
that is marked as succeeded or failed with the value held by result
.
func makeCompletedFuture<Success>(withResultOf: () throws -> Success) -> EventLoopFuture<Success>
Creates and returns a new EventLoopFuture
that is marked as succeeded or failed with the value returned by body
.
func makeFailedFuture<T>(Error) -> EventLoopFuture<T>
Creates and returns a new EventLoopFuture
that is already marked as failed. Notifications will be done using this EventLoop
as execution NIOThread
.
func makeFutureWithTask<Return>(@escaping () async throws -> Return) -> EventLoopFuture<Return>
func makeIterator() -> EventLoopIterator
Returns an EventLoopIterator
over this EventLoop
.
func makePromise<T>(of: T.Type, file: StaticString, line: UInt) -> EventLoopPromise<T>
Creates and returns a new EventLoopPromise
that will be notified using this EventLoop
as execution NIOThread
.
func makeSucceededFuture<Success>(Success) -> EventLoopFuture<Success>
Creates and returns a new EventLoopFuture
that is already marked as success. Notifications will be done using this EventLoop
as execution NIOThread
.
func makeSucceededVoidFuture() -> EventLoopFuture<Void>
Default implementation of makeSucceededVoidFuture
: Return a fresh future (which will allocate).
func next() -> EventLoop
An EventLoop
forms a singular EventLoopGroup
, returning itself as the ‘next’ EventLoop
.
func preconditionInEventLoop(file: StaticString, line: UInt)
Checks the necessary condition of currently running on the called EventLoop
for making forward progress.
func preconditionNotInEventLoop(file: StaticString, line: UInt)
Checks the necessary condition of currently not running on the called EventLoop
for making forward progress.
func scheduleCallback(at: NIODeadline, handler: some (NIOScheduledCallbackHandler & Sendable)) -> NIOScheduledCallback
Default implementation of scheduleCallback(at deadline:handler:)
: backed by EventLoop.scheduleTask
.
func scheduleRepeatedAsyncTask(initialDelay: TimeAmount, delay: TimeAmount, maximumAllowableJitter: TimeAmount, notifying: EventLoopPromise<Void>?, @escaping (RepeatedTask) -> EventLoopFuture<Void>) -> RepeatedTask
Schedule a repeated asynchronous task to be executed by the EventLoop
with a fixed delay between the end and start of each task.
func scheduleRepeatedAsyncTask(initialDelay: TimeAmount, delay: TimeAmount, notifying: EventLoopPromise<Void>?, @escaping (RepeatedTask) -> EventLoopFuture<Void>) -> RepeatedTask
Schedule a repeated asynchronous task to be executed by the EventLoop
with a fixed delay between the end and start of each task.
func scheduleRepeatedTask(initialDelay: TimeAmount, delay: TimeAmount, maximumAllowableJitter: TimeAmount, notifying: EventLoopPromise<Void>?, @escaping (RepeatedTask) throws -> Void) -> RepeatedTask
Schedule a repeated task to be executed by the EventLoop
with a fixed delay between the end and start of each task.
func scheduleRepeatedTask(initialDelay: TimeAmount, delay: TimeAmount, notifying: EventLoopPromise<Void>?, @escaping (RepeatedTask) throws -> Void) -> RepeatedTask
Schedule a repeated task to be executed by the EventLoop
with a fixed delay between the end and start of each task.
func submit<T>(@escaping () throws -> T) -> EventLoopFuture<T>
Submit task
to be run on this EventLoop
.