_scheduleCallback(at:handler:)
NIOScheduledCallback.swift:97@preconcurrency func _scheduleCallback(at deadline: NIODeadline, handler: some (NIOScheduledCallbackHandler & Sendable)) -> NIOScheduledCallback
@preconcurrency func _scheduleCallback(at deadline: NIODeadline, handler: some (NIOScheduledCallbackHandler & Sendable)) -> NIOScheduledCallback
s7NIOCore9EventLoopPAAE17_scheduleCallback2at7handlerAA012NIOScheduledE0VAA11NIODeadlineV_qd__tAA0hE7HandlerRd__lF
What are these?3XNYI
import NIOCore
The core abstractions that make up SwiftNIO.
protocol EventLoop : EventLoopGroup
An EventLoop processes IO / tasks in an endless loop for Channel
s until it’s closed.
struct NIODeadline
Represents a point in time.
protocol NIOScheduledCallbackHandler
A type that handles callbacks scheduled with EventLoop.scheduleCallback(at:handler:)
.
protocol Sendable
struct NIOScheduledCallback
An opaque handle that can be used to cancel a scheduled callback.
var executor: any SerialExecutor { get }
func _preconditionSafeToWait(file: StaticString, line: UInt)
func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier) -> (file: StaticString, line: UInt)?
Default implementation of _promiseCompleted
: does nothing.
func _promiseCreated(futureIdentifier: _NIOEventLoopFutureIdentifier, file: StaticString, line: UInt)
Default implementation of _promiseCreated
: does nothing.
func any() -> EventLoop
An EventLoop
forms a singular EventLoopGroup
, returning itself as ‘any’ EventLoop
.
func assertInEventLoop(file: StaticString = #fileID, line: UInt = #line)
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 = #fileID, line: UInt = #line)
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(_ scheduledCallback: NIOScheduledCallback)
Default implementation of cancelScheduledCallback(_:)
: only cancels callbacks scheduled by the default implementation of scheduleCallback
.
func close() throws
Close this EventLoop
.
func enqueue(_ job: consuming ExecutorJob)
@discardableResult @preconcurrency func flatScheduleTask<T>(deadline: NIODeadline, file: StaticString = #fileID, line: UInt = #line, _ task: @escaping () throws -> EventLoopFuture<T>) -> Scheduled<T> where T : Sendable
Schedule a task
that is executed by this EventLoop
at the given time.
@discardableResult @preconcurrency func flatScheduleTask<T>(in delay: TimeAmount, file: StaticString = #fileID, line: UInt = #line, _ task: @escaping () throws -> EventLoopFuture<T>) -> Scheduled<T> where T : Sendable
Schedule a task
that is executed by this EventLoop
after the given amount of time.
@preconcurrency func flatSubmit<T>(_ task: @escaping () -> EventLoopFuture<T>) -> EventLoopFuture<T> where T : Sendable
Submit task
to be run on this EventLoop
.
@preconcurrency func makeCompletedFuture<Success>(_ result: Result<Success, Error>) -> EventLoopFuture<Success> where Success : Sendable
Creates and returns a new EventLoopFuture
that is marked as succeeded or failed with the value held by result
.
@preconcurrency func makeCompletedFuture<Success>(withResultOf body: () throws -> Success) -> EventLoopFuture<Success> where Success : Sendable
Creates and returns a new EventLoopFuture
that is marked as succeeded or failed with the value returned by body
.
func makeFailedFuture<T>(_ error: 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
.
@preconcurrency func makeFutureWithTask<Return>(_ body: @escaping () async throws -> Return) -> EventLoopFuture<Return> where Return : Sendable
func makeIterator() -> EventLoopIterator
Returns an EventLoopIterator
over this EventLoop
.
func makePromise<T>(of type: T.Type = T.self, file: StaticString = #fileID, line: UInt = #line) -> EventLoopPromise<T>
Creates and returns a new EventLoopPromise
that will be notified using this EventLoop
as execution NIOThread
.
@preconcurrency func makeSucceededFuture<Success>(_ value: Success) -> EventLoopFuture<Success> where Success : Sendable
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 = #fileID, line: UInt = #line)
Checks the necessary condition of currently running on the called EventLoop
for making forward progress.
func preconditionNotInEventLoop(file: StaticString = #fileID, line: UInt = #line)
Checks the necessary condition of currently not running on the called EventLoop
for making forward progress.
@discardableResult @preconcurrency func scheduleCallback(at deadline: NIODeadline, handler: some (NIOScheduledCallbackHandler & Sendable)) -> NIOScheduledCallback
Default implementation of scheduleCallback(at deadline:handler:)
: backed by EventLoop.scheduleTask
.
@discardableResult @preconcurrency func scheduleCallback(in amount: TimeAmount, handler: some (NIOScheduledCallbackHandler & Sendable)) throws -> NIOScheduledCallback
Default implementation of scheduleCallback(in amount:handler:)
: calls scheduleCallback(at deadline:handler:)
.
@discardableResult func scheduleRepeatedAsyncTask(initialDelay: TimeAmount, delay: TimeAmount, maximumAllowableJitter: TimeAmount, notifying promise: EventLoopPromise<Void>? = nil, _ task: @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.
@discardableResult @preconcurrency func scheduleRepeatedAsyncTask(initialDelay: TimeAmount, delay: TimeAmount, notifying promise: EventLoopPromise<Void>? = nil, _ task: @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.
@discardableResult func scheduleRepeatedTask(initialDelay: TimeAmount, delay: TimeAmount, maximumAllowableJitter: TimeAmount, notifying promise: EventLoopPromise<Void>? = nil, _ task: @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.
@discardableResult @preconcurrency func scheduleRepeatedTask(initialDelay: TimeAmount, delay: TimeAmount, notifying promise: EventLoopPromise<Void>? = nil, _ task: @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.
@preconcurrency func submit<T>(_ task: @escaping () throws -> T) -> EventLoopFuture<T> where T : Sendable
Submit task
to be run on this EventLoop
.
func makeFailedFuture<T>(_ error: Error, file: StaticString = #fileID, line: UInt = #line) -> EventLoopFuture<T>
@preconcurrency func makeSucceededFuture<Success>(_ value: Success, file: StaticString = #fileID, line: UInt = #line) -> EventLoopFuture<Success> where Success : Sendable