InlineComputeThreadPool
public struct InlineComputeThreadPool : ComputeThreadPool
A ComputeThreadPool that executes everything immediately on the current thread.
This threadpool implementation is useful for testing correctness, as well as avoiding context switches when a computation is designed to be parallelized at a coarser level.
-
Initializes
self.Declaration
Swift
public init() -
The maximum number of concurrent threads of execution supported by this thread pool.
Declaration
Swift
public var maxParallelism: Int { get } -
The index of the current thread.
Declaration
Swift
public var currentThreadIndex: Int? { get } -
Dispatch
fnto be run at some point in the future (immediately).Note: this implementation just executes
fnimmediately.Declaration
Swift
public func dispatch(_ fn: () -> Void) -
Executes
aandboptionally in parallel, and returns when both are complete.Note: this implementation simply executes them serially.
Declaration
Swift
public func join(_ a: () -> Void, _ b: () -> Void) -
Executes
aandboptionally in parallel, and returns when both are complete.Note: this implementation simply executes them serially.
Declaration
Swift
public func join(_ a: () throws -> Void, _ b: () throws -> Void) throws -
Declaration
Swift
public func parallelFor(n: Int, _ fn: VectorizedParallelForBody) -
Declaration
Swift
public func parallelFor(n: Int, _ fn: ThrowingVectorizedParallelForBody) throws
View on GitHub
InlineComputeThreadPool Structure Reference