ConcurrencyPlatform
public protocol ConcurrencyPlatform
Abstracts over different concurrency abstractions.
Some environments have different concurrency abstractions, such as fundamental locks, threads and condition variables. This protocol allows writing code that is generic across the different concurrency environments.
These abstractions are designed to be relatively minimialistic in order to be easy to port to a variety of environments. Key environments include: macOS, Linux, Android, Windows, and Google’s internal enviornment.
-
The type of mutexes (aka locks) used.
Declaration
Swift
associatedtype Mutex
-
The type of conditional mutexes that are available.
Declaration
Swift
associatedtype ConditionMutex
-
The type of the condition variable that’s available.
Declaration
Swift
associatedtype ConditionVariable: ConditionVariableProtocol & DefaultInitializable where ConditionVariable.Mutex == Mutex
-
The type of threads that are used.
Declaration
Swift
associatedtype Thread : ThreadProtocol
-
The thread local storage.
Declaration
Swift
associatedtype BaseThreadLocalStorage : RawThreadLocalStorage
-
A convenient type to manage thread local storage.
Declaration
Swift
typealias ThreadLocalStorage = TypedThreadLocalStorage<BaseThreadLocalStorage>
-
Makes a thread.
Declaration
Swift
func makeThread(name: String, _ fn: @escaping () -> Void) -> Thread