Edit

Share via


SpinLockExtensions Class

Definition

Helpers for working with the SpinLock type.

public static class SpinLockExtensions
type SpinLockExtensions = class
Public Class SpinLockExtensions
Inheritance
SpinLockExtensions

Methods

Enter(Object, SpinLock)
Enter(SpinLock*)

Enters a specified SpinLock instance and returns a wrapper to use to release the lock. This extension should be used though a using block or statement:

SpinLock spinLock = new SpinLock();

using (SpinLockExtensions.Enter(&spinLock))
{
    // Thread-safe code here...
}

The compiler will take care of releasing the SpinLock when the code goes out of that using scope.

Applies to