base::SlowLock Class Reference

SlowLock is a a recursive locking mechanism for slow functions. More...

#include <base_thread_lock.hh>

List of all members.

Public Member Functions

 SlowLock (void)
 ~SlowLock ()
void Lock (void)
void Unlock (void)
bool IfLocked (void)
bool TryLock (void)

Private Attributes

pthread_mutex_t mMutex
 volatile unnecessary and causes compile problems

Classes

class  Auto


Detailed Description

SlowLock is a a recursive locking mechanism for slow functions.

Remarks:
PLACE IN PERSISTENT MEMORY (NOT CALL STACK).
Implemented by pthread mutex. Locking a pthread mutex is considered a more expensive operation than a spinlock because pthread doesn't know the duration of a locked routine so it may call the OS kernel to sleep.

Constructor & Destructor Documentation

base::SlowLock::SlowLock ( void   ) 

ctor/dtor.

base::SlowLock::~SlowLock (  ) 


Member Function Documentation

void base::SlowLock::Lock ( void   ) 

Lock/unlock mutex.

void base::SlowLock::Unlock ( void   ) 

bool base::SlowLock::IfLocked ( void   ) 

Returns false if ANOTHER THREAD OWNS THE LOCK. Else returns true.

bool base::SlowLock::TryLock ( void   ) 

Try to take the lock.

NOTE: Unlock() should be called after TryLock() succeeds!

"If the mutex type is PTHREAD_MUTEX_RECURSIVE and the mutex is currently owned by the calling thread, the mutex lock count shall be incremented by one and the pthread_mutex_trylock() function shall immediately return success."


Member Data Documentation

pthread_mutex_t base::SlowLock::mMutex [private]

volatile unnecessary and causes compile problems


The documentation for this class was generated from the following files: Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:19 2007