3rd Eye Scene C#
3rd Eye Scene C# documentation
Tes::Threading::SpinLock Class Reference

A spin lock using atomic operations. More...

List of all members.

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.

Detailed Description

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();
        }
      }

Member Function Documentation

void Tes::Threading::SpinLock::Enter ( ref bool  lockTaken) [inline]

For future System.Threading.SpinLock compatability.

Aliases TryLock().

Parameters:
lockTakenTrue if the lock is attained.
void Tes::Threading::SpinLock::Exit ( bool  useMemoryBarrier) [inline]

For future System.Threading.SpinLock compatability.

Aliases Unlock().

Parameters:
useMemoryBarrierNot used.
bool Tes::Threading::SpinLock::TryLock ( ) [inline]

Try to attain the lock.

This supports non-blocking lock attempts.

Returns:
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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events