Structs
The following structs are available globally.
-
Provides a type-safe mechanism for accessing thread-local values (of type
T
) stored in thethreadDictionary
associated with the calling thread.As the class name implies, values set using
See moreThreadLocalValue
are only visible to the thread that set those values.Declaration
Swift
public struct ThreadLocalValue<T: Any>
-
CriticalSection
s can be used to ensure exclusive access to a given resource.By protecting a resource with a
CriticalSection
, you ensure that only one one thread can be executing code using that critical section at any given time.
See moreCriticalSection
s are re-entrant, meaning that code already holding access to the critical section may re-enter the critical section without causing a deadlock. (TheNSRecursiveLock
class is used under the hood.)Declaration
Swift
public struct CriticalSection