_promiseCompleted(futureIdentifier:)
Default implementation of _promiseCompleted
: does nothing.
func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier) -> (file: StaticString, line: UInt)?
Default implementation of _promiseCompleted
: does nothing.
func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier) -> (file: StaticString, line: UInt)?
s7NIOCore9EventLoopPAAE17_promiseCompleted16futureIdentifiers12StaticStringV4file_Su4linetSgAA09_NIOEventc6FutureG0V_tF
What are these?1X68N
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 _NIOEventLoopFutureIdentifier
An opaque identifier for a specific EventLoopFuture
.
@frozen struct StaticString
A string type designed to represent text that is known at compile time.
@frozen struct UInt
An unsigned integer value type.
func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier) -> (file: StaticString, line: UInt)?
Debug hook: complete a specific promise and return its creation location.
var executor: any SerialExecutor { get }
var now: NIODeadline { get }
Default implementation of now
: Returns NIODeadline.now()
.
func _executeIsolatedUnsafeUnchecked(_ task: @escaping () -> Void)
Default implementation: wraps the task in an UnsafeTransfer.
func _preconditionSafeToWait(file: StaticString, line: UInt)
func _promiseCreated(futureIdentifier: _NIOEventLoopFutureIdentifier, file: StaticString, line: UInt)
Default implementation of _promiseCreated
: does nothing.
@preconcurrency func _scheduleCallback(at deadline: NIODeadline, handler: some (NIOScheduledCallbackHandler & Sendable)) -> NIOScheduledCallback
@discardableResult func _scheduleTaskIsolatedUnsafeUnchecked<T>(deadline: NIODeadline, _ task: @escaping () throws -> T) -> Scheduled<T>
Default implementation: wraps the task in an UnsafeTransfer.
@discardableResult func _scheduleTaskIsolatedUnsafeUnchecked<T>(in delay: TimeAmount, _ task: @escaping () throws -> T) -> Scheduled<T>
Default implementation: wraps the task in an UnsafeTransfer.
func _submitIsolatedUnsafeUnchecked<T>(_ task: @escaping () throws -> T) -> EventLoopFuture<T>
Default implementation: wraps the task in an UnsafeTransfer.
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 assumeIsolated() -> NIOIsolatedEventLoop
Assumes the calling context is isolated to the event loop.
func assumeIsolatedUnsafeUnchecked() -> NIOIsolatedEventLoop
Assumes the calling context is isolated to the event loop.
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>
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