ComputeThreadPools
public enum ComputeThreadPools
A namespace for threadpool operations.
-
A global default
ComputeThreadPool.When you need a
ComputeThreadPooluse thelocalComputeThreadPool, as this allows parts of the app to configure a customizedComputeThreadPool.globalis used when thelocalthread pool hasn’t yet been set. (In particular, the global thread pool is copied into the thread-local storage upon first access.)globalis made public so that early upon a process start-up (before any references tolocalare made), code can cofigure a customizedglobalthread pool.See also
localDeclaration
Swift
public static var global: ComputeThreadPool -
A thread local
ComputeThreadPool.Use this thread pool whenever you need a thread pool in your applications and have not been provided one by the caller. (Rationale: by using a thread-local instead of a global, regions of code can be easily configured to use a given
ComputeThreadPool).Declaration
Swift
public static var local: ComputeThreadPool { get set } -
The thread index for the current thread, based on the current thread-local compute pool.
Declaration
Swift
public static var currentThreadIndex: Int? { get } -
The amount of parallelism provided by the current thread-local compute pool.
Declaration
Swift
public static var maxParallelism: Int { get } -
Sets
pooltolocalfor the duration ofbody.Declaration
Swift
public static func withPool<T>(_ pool: ComputeThreadPool, _ body: () throws -> T) rethrows -> T
View on GitHub
ComputeThreadPools Enumeration Reference