xvr2::Mutex Class Reference

#include <Mutex.h>

Inheritance diagram for xvr2::Mutex:

Inheritance graph
[legend]

List of all members.


Detailed Description

This classes handle MUTEX (MUTual EXclusion) sinchronization devices
This classes are designed to work with SDL's Thread encapsulation, GNU Pth or POSIX Threads.

Todo:
Polish documentation.

Definition at line 35 of file Mutex.h.


Public Member Functions

 Mutex (int autoinit=1)
 Constructor initialize using default atttributes, this depends on how you compiled the library if you chose GNU Pth then the first argument is meaningfull.
virtual ~Mutex ()
 This destructor calls dastroy to ensure that all the resources used by the Mutex all released automagically.
void init ()
 Initializer, use in case of not using the default constructor (this interface is provided for future compatibility).
void lock ()
 Use this to explicitely lock the mutex.
void trylock ()
 Use this attemp a lock on the thread, if the mutex has already been locked, then it will throw a corresponding exception.
void unlock ()
 Use this to explicitely unlock the mutex.
virtual const char * getClassName ()
 Returns the name of the current class.
virtual std::string toString ()

Static Public Member Functions

static void debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)
 Will print a debug message to the screen.
static void debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)

Public Attributes

pthread_mutex_t mutex
 The mutex object itself as defined by POSIX Threads GNU Pth or SDL.
pthread_mutexattr_t m_attr

Protected Attributes

std::string __cls_name

Private Member Functions

void destroy ()
 Destroys the current mutex, freeing all the resources allocated by it.

Friends

std::ostream & operator<< (std::ostream &stream, const Object &s)

Constructor & Destructor Documentation

xvr2::Mutex::Mutex ( int  autoinit = 1  ) 

Constructor initialize using default atttributes, this depends on how you compiled the library if you chose GNU Pth then the first argument is meaningfull.

virtual xvr2::Mutex::~Mutex (  )  [virtual]

This destructor calls dastroy to ensure that all the resources used by the Mutex all released automagically.


Member Function Documentation

void xvr2::Mutex::destroy (  )  [private]

Destroys the current mutex, freeing all the resources allocated by it.

void xvr2::Mutex::init (  ) 

Initializer, use in case of not using the default constructor (this interface is provided for future compatibility).

void xvr2::Mutex::lock (  ) 

void xvr2::Mutex::trylock (  ) 

Use this attemp a lock on the thread, if the mutex has already been locked, then it will throw a corresponding exception.

void xvr2::Mutex::unlock (  ) 

virtual const char* xvr2::Object::getClassName (  )  [virtual, inherited]

Returns the name of the current class.

static void xvr2::Object::debugmsg ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

Will print a debug message to the screen.

static void xvr2::Object::debugmsgln ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

virtual std::string xvr2::Object::toString (  )  [virtual, inherited]


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Object s 
) [friend, inherited]


Member Data Documentation

pthread_mutex_t xvr2::Mutex::mutex

The mutex object itself as defined by POSIX Threads GNU Pth or SDL.

Definition at line 48 of file Mutex.h.

pthread_mutexattr_t xvr2::Mutex::m_attr

Definition at line 49 of file Mutex.h.

std::string xvr2::Object::__cls_name [protected, inherited]

Definition at line 30 of file Object.h.


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

Generated on Fri Jun 20 22:55:55 2008 for X-VR2 SDK by  doxygen 1.5.5