Instance Methodswift-nio 2.72.0NIOPosix
shutdownGracefully
Shuts down the thread pool gracefully.
NIOThreadPool.swift:390- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
func shutdownGracefully() async throws
Other members in extension
Types
enum WorkItemState
The state of the
WorkItem
.
Typealiases
typealias WorkItem
The work that should be done by the
NIOThreadPool
.
Type members
init(numberOfThreads: Int
) Initialize a
NIOThreadPool
thread pool withnumberOfThreads
threads.static var singleton: NIOThreadPool
A globally shared, singleton
NIOThreadPool
.
Show implementation details (1)
Hide implementation details
static func _makePerpetualStartedPool(numberOfThreads: Int, threadNamePrefix: String
) -> NIOThreadPool Create a
NIOThreadPool
that is already started, cannot be shut down and must not bedeinit
ed.
Instance members
let numberOfThreads: Int
func runIfActive<T>(@escaping () throws -> T
) async throws -> T Runs the submitted closure if the thread pool is still active, otherwise throw an error. The closure will be run on the thread pool so can do blocking work.
func runIfActive<T>(eventLoop: EventLoop, @escaping () throws -> T
) -> EventLoopFuture<T> Runs the submitted closure if the thread pool is still active, otherwise fails the promise. The closure will be run on the thread pool so can do blocking work.
func shutdownGracefully(@escaping (Error?) -> Void
) func shutdownGracefully(queue: DispatchQueue, @escaping (Error?) -> Void
) Gracefully shutdown this
NIOThreadPool
. All tasks will be run before shutdown will take place.func start(
) Start the
NIOThreadPool
if not already started.func submit(@escaping WorkItem
) Submit a
WorkItem
to process.func syncShutdownGracefully(
) throws