Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

SpinLock Class Reference

List of all members.

Public Methods

 SpinLock ()
bool AttemptLock (unsigned i_spin_count=GetDefaultSpinCount())
void MustLock ()
LONG ReleaseLock ()
LONG MarkForWakeup ()

Public Attributes

volatile LONG m_value

Detailed Description

SpinLock is the basic element for user level locks. This lock will not lock forever, it will "fail" to attain a lock if the lock is not aquired after the appropriate number of spins.


Constructor & Destructor Documentation

SpinLock::SpinLock   [inline]
 


Member Function Documentation

bool SpinLock::AttemptLock unsigned    i_spin_count = GetDefaultSpinCount() [inline]
 

AttemptLock will attempt to attain a lock after a said number of spins.

Parameters:
i_spin_count  the count of spins
Returns:
true if the lock was attained, false otherwise

LONG SpinLock::MarkForWakeup   [inline]
 

MarkForWakeup will increment the m_value value which will contain the number of threads that are waiting for a lock. If the value returned is "1", it indicates that this thread has actually aquired the lock instead of simply marking a wake-up. If the thread count is greater than 1, the caller MUST wait on the semaphore.

void SpinLock::MustLock   [inline]
 

MustLock will spin forever to attain the lock. This must only be used in cases where a spinlock will be held for a very short time. This will yield the cpu when attempting

Returns:
nothing

LONG SpinLock::ReleaseLock   [inline]
 

ReleaseLock will release the given lock. It the value returned is not zero, then there are threads that are marked for wake-up. These threads


Member Data Documentation

volatile LONG SpinLock::m_value
 


The documentation for this class was generated from the following file:

Generated for Austria by doxygen and MakeXS at Sun Oct 24 17:35:34 PDT 2004