Mono Class Library: System.Threading NamespaceSystem.Threading.Interlocked Class |
See Also: Interlocked Members
|
All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.
The System.Threading.Interlocked methods protect against errors that can occur when the scheduler switches contexts while a thread is updating a variable that can be accessed by other threads. The members of this class do not throw exceptions.
Note:[Edit]The Interlocked.Increment(Int32@) method and its counterpart, Interlocked.Decrement(Int32@), increment or decrement a variable and store the resulting value, as an atomic operation.
The Interlocked.Exchange(Int32@, int) method atomically exchanges the values of the specified variables. The Interlocked.CompareExchange(Int32@, int, int) method provides an atomic operation that compares two values and stores a third value in one of the variables, based on the outcome of the comparison.
Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0