Op Englesch liesen Editéieren

Deelen iwwer


SpinLock.Exit Method

Definition

Releases the lock.

Overloads

Exit()

Releases the lock.

Exit(Boolean)

Releases the lock.

Exit()

Source:
SpinLock.cs
Source:
SpinLock.cs
Source:
SpinLock.cs

Releases the lock.

C#
public void Exit();

Exceptions

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

Remarks

The default overload of Exit provides the same behavior as if calling Exit using true as the argument.

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

See also

Applies to

.NET 10 an aner Versiounen
Produkt Versiounen
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

Exit(Boolean)

Source:
SpinLock.cs
Source:
SpinLock.cs
Source:
SpinLock.cs

Releases the lock.

C#
public void Exit(bool useMemoryBarrier);

Parameters

useMemoryBarrier
Boolean

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

Exceptions

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

Remarks

Calling Exit with the useMemoryBarrier argument set to true will improve the fairness of the lock at the expense of some performance. The default Exit 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.

See also

Applies to

.NET 10 an aner Versiounen
Produkt Versiounen
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0