SpinLockExtensions.Enter Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Enter(SpinLock) |
Enters a specified SpinLock instance and returns a wrapper to use to release the lock.
This extension should be used though a
The compiler will take care of releasing the SpinLock when the code goes out of that |
Enter(SpinLock*) |
Enters a specified SpinLock instance and returns a wrapper to use to release the lock.
This extension should be used though a
The compiler will take care of releasing the SpinLock when the code goes out of that |
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 (spinLock.Enter())
{
// Thread-safe code here...
}
The compiler will take care of releasing the SpinLock when the code goes out of that using
scope.
public static Microsoft.Toolkit.HighPerformance.SpinLockExtensions.Lock Enter (this ref System.Threading.SpinLock spinLock);
static member Enter : SpinLock -> Microsoft.Toolkit.HighPerformance.SpinLockExtensions.Lock
<Extension()>
Public Function Enter (ByRef spinLock As SpinLock) As SpinLockExtensions.Lock
Parameters
Returns
A wrapper type that will release spinLock
when its Dispose() method is called.
Remarks
The returned SpinLockExtensions.Lock value shouldn't be used directly: use this extension in a using
block or statement.
Applies to
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.
public static Microsoft.Toolkit.HighPerformance.SpinLockExtensions.UnsafeLock Enter (System.Threading.SpinLock* spinLock);
static member Enter : nativeptr<System.Threading.SpinLock> -> Microsoft.Toolkit.HighPerformance.SpinLockExtensions.UnsafeLock
Parameters
Returns
A wrapper type that will release spinLock
when its Dispose() method is called.
Remarks
The returned SpinLockExtensions.UnsafeLock value shouldn't be used directly: use this extension in a using
block or statement.