My Project
Public Types | Public Member Functions | List of all members
ParaEngine::mutex Class Reference

cross platform mutex More...

#include <mutex.h>

Public Types

typedef scoped_Lock< mutexScopedLock
 

Public Member Functions

 mutex ()
 Construct a mutex. More...
 
 mutex (const mutex &in_mutex)
 Copy Constructor a mutex (copy the locked state only) More...
 
mutexoperator= (const mutex &in_mutex)
 Copy a mutex (copy the locked state only) More...
 
virtual ~mutex ()
 Destructor.
 
bool lock ()
 lock a mutex More...
 
bool tryLock ()
 lock a mutex More...
 
bool unlock ()
 unlock a mutex More...
 
bool isLocked () const
 Fast locked look up. More...
 

Detailed Description

cross platform mutex

This class represent a simple way to use mutex

mutex mut;

mutex::ScopedLock lock_(mut); // scoped lock.

mut.lock(); // lock ... mut.islocked(); // fast look up ... mut.unlock(); // unlock mut.tryLock(); // try lock

Constructor & Destructor Documentation

§ mutex() [1/2]

ParaEngine::mutex::mutex ( )
inline

Construct a mutex.

Posix and Win mutex

§ mutex() [2/2]

ParaEngine::mutex::mutex ( const mutex in_mutex)
inline

Copy Constructor a mutex (copy the locked state only)

Parameters
Basedmutex

Member Function Documentation

§ isLocked()

bool ParaEngine::mutex::isLocked ( ) const
inline

Fast locked look up.

Returns
true if locked else false This methode use the fast look up variable but still CONST if you want to test perfectly do : if(myMutex.tryLock()){ myMutex.unlock(); // I am sure that the mutex is not locked } else{ // The mutex is locked }

§ lock()

bool ParaEngine::mutex::lock ( )
inline

lock a mutex

Returns
WIN true
POSIX true if success

§ operator=()

mutex& ParaEngine::mutex::operator= ( const mutex in_mutex)
inline

Copy a mutex (copy the locked state only)

Parameters
Basedmutex
Returns
Current mutex

§ tryLock()

bool ParaEngine::mutex::tryLock ( )
inline

lock a mutex

Returns
true if success else false (if busy or error)

§ unlock()

bool ParaEngine::mutex::unlock ( )
inline

unlock a mutex

Returns
WIN true in every cases
POSIX true if success

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