|
3rd Eye Scene C#
3rd Eye Scene C# documentation
|
A spin lock using atomic operations. More...
Public Member Functions | |
| void | Lock () |
| Block until the lock is attained. | |
| bool | TryLock () |
| Try to attain the lock. | |
| void | Unlock () |
| Unlocks if currently locked. | |
| void | Enter (ref bool lockTaken) |
| For future System.Threading.SpinLock compatability. | |
| void | Exit (bool useMemoryBarrier) |
| For future System.Threading.SpinLock compatability. | |
A spin lock using atomic operations.
To ensure correct unlocking even on exception, the recommended usage is:
void ProtectedFunction(SpinLock lock) { lock.lock(); try { // Your code here. } finally { lock.unlock(); } }
| void Tes::Threading::SpinLock::Enter | ( | ref bool | lockTaken | ) | [inline] |
For future System.Threading.SpinLock compatability.
Aliases TryLock().
| lockTaken | True if the lock is attained. |
| void Tes::Threading::SpinLock::Exit | ( | bool | useMemoryBarrier | ) | [inline] |
For future System.Threading.SpinLock compatability.
Aliases Unlock().
| useMemoryBarrier | Not used. |
| bool Tes::Threading::SpinLock::TryLock | ( | ) | [inline] |
Try to attain the lock.
This supports non-blocking lock attempts.
true if the lock has been attained, false if the lock is owned elsewhere.| void Tes::Threading::SpinLock::Unlock | ( | ) | [inline] |
Unlocks if currently locked.
This should only ever be called by the owner of the lock, otherwise the lock will be erroneously released.