System.Threading.SpinLock.Exit Method

Releases the lock.

Syntax

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
public void Exit (bool useMemoryBarrier)

Parameters

useMemoryBarrier
A Boolean value that indicates whether a memory fence should be issued in order to immediately publish the exit operation to other threads.

Remarks

Calling SpinLock.Exit(bool) with the useMemoryBarrier argument set to true will improve the fairness of the lock at the expense of some performance. The default SpinLock.Exit overload behaves as if specifying true for useMemoryBarrier.

If you call SpinLock.Exit without having first called SpinLock.Enter(Boolean@) the internal state of the System.Threading.SpinLock can become corrupted.

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0