Exit Method (Boolean)

Task Parallel System.Threading

Releases the lock.

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

Syntax

Visual Basic (Declaration)
Public Sub Exit ( _
	useMemoryBarrier As Boolean _
)
C#
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.

Remarks

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

Exceptions

ExceptionCondition
System.Threading..::.SynchronizationLockException Thread ownership tracking is enabled, and the current thread is not the owner of this lock.

See Also