CrissCross::System Namespace Reference

The system call namespace. More...


Classes

class  Mutex
 A mutex class for safe multithreading. More...
class  ReadWriteLock
 A read-write lock. More...
class  MutexHolder
 A mutex holder which locks a Mutex class. More...
class  RWLockHolder
 A read/write lock holder which locks a Mutex class. More...
class  Stopwatch
 A timer class designed for code profiling. More...

Enumerations

enum  MutexType { MUTEX_TYPE_NORMAL, MUTEX_TYPE_RECURSIVE, MUTEX_TYPE_ERRORCHECK }
 The type of mutex to be created. More...
enum  RWLockHolderType
 The type of mutex holder to create.

Functions

void InitTimer ()
 Initializes the high-resolution timer.
void SetTimerState (bool _paused)
 Pauses or resumes the high-resolution timer.
void AdvancePausedTimer (double _seconds)
 Increments the paused timer by the specified value.
double GetHighResTime ()
 Gets the time since InitTimer() was called.
void ThreadSleep (int _msec)
 Sleeps the current thread for a specified time.
long RandomNumber ()
 Generates a random number.
void SeedRandom ()
 Generates a random number.


Detailed Description

The system call namespace.

Contains platform-specific API call wrappers, which allow the programmer to write code which is cross-platform and functions identically on all platforms.


Enumeration Type Documentation

enum MutexType

The type of mutex to be created.

Enumerator:
MUTEX_TYPE_NORMAL  This type of mutex does not detect deadlock. A thread attempting to relock this mutex without first unlocking it will deadlock. Attempting to unlock a mutex locked by a different thread results in undefined behaviour. Attempting to unlock an unlocked mutex results in undefined behaviour.
MUTEX_TYPE_RECURSIVE  A thread attempting to relock this mutex without first unlocking it will succeed in locking the mutex. The relocking deadlock which can occur with mutexes of type MUTEX_TYPE_NORMAL cannot occur with this type of mutex. Multiple locks of this mutex require the same number of unlocks to release the mutex before another thread can acquire the mutex. A thread attempting to unlock a mutex which another thread has locked will return with an error. A thread attempting to unlock an unlocked mutex will return with an error.
MUTEX_TYPE_ERRORCHECK  This type of mutex provides error checking. A thread attempting to relock this mutex without first unlocking it will return with an error. A thread attempting to unlock a mutex which another thread has locked will return with an error. A thread attempting to unlock an unlocked mutex will return with an error.


Function Documentation

void CrissCross::System::AdvancePausedTimer ( double  _seconds  ) 

Increments the paused timer by the specified value.

Parameters:
_seconds Time in seconds to increase the timer by.

double CrissCross::System::GetHighResTime (  ) 

Gets the time since InitTimer() was called.

Returns:
Time in seconds since InitTimer().

long CrissCross::System::RandomNumber (  ) 

Generates a random number.

Don't forget to use SeedRandom() first!

See also:
SeedRandom()

void CrissCross::System::SeedRandom (  ) 

Generates a random number.

Seeds the random number generator with the current time.

void CrissCross::System::SetTimerState ( bool  _paused  ) 

Pauses or resumes the high-resolution timer.

If _paused is true, the current timestamp on the high-resolution timer is locked. If _paused is false, the GetHighResTime() will compensate for the pause duration.

Parameters:
_paused Indicates whether to pause or unpause the timer.

void CrissCross::System::ThreadSleep ( int  _msec  ) 

Sleeps the current thread for a specified time.

Parameters:
_msec Time to sleep for, in milliseconds.


Generated on Sun Feb 8 11:10:00 2009 for CrissCross by  doxygen 1.5.8