Namespace: System.Threading
SpinLock
Provides a mutual exclusion lock primitive where a thread trying to acquire the lock waits in a loop repeatedly checking until the lock becomes available.
Methods (3)
void Enter(Boolean@)
Acquires the lock in a reliable manner, such that even if an exception occurs within the method call, lockTaken can be examined reliably to determine whether the lock was acquired.
| Parameter | Description |
|---|---|
| lockTaken | True if the lock is acquired; otherwise, false. lockTaken must be initialized to false prior to calling this method. |
void Exit
Releases the lock.
void TryEnter(Boolean@)
Attempts to acquire the lock in a reliable manner, such that even if an exception occurs within the method call, lockTaken can be examined reliably to determine whether the lock was acquired.
| Parameter | Description |
|---|---|
| lockTaken | True if the lock is acquired; otherwise, false. lockTaken must be initialized to false prior to calling this method. |