Exit Method (Boolean)
Collapse the table of content
Expand the table of content

SpinLock.Exit Method (Boolean)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Releases the lock.

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

public void Exit(
	bool useMemoryBarrier
)

Parameters

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

ExceptionCondition
SynchronizationLockException

Thread ownership tracking is enabled, and the current thread is not the owner of this lock.

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

If you call Exit without having first called Enter the internal state of the SpinLock can become corrupted.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft