Public Member Functions | Private Member Functions | Private Attributes
UMutex Class Reference

#include <UMutex.h>

List of all members.

Public Member Functions

int lock () const
int lockTry () const
 UMutex ()
int unlock () const
virtual ~UMutex ()

Private Member Functions

void operator= (UMutex &M)
 UMutex (const UMutex &M)

Private Attributes

pthread_mutex_t M

Detailed Description

A mutex class.

On a lock() call, the calling thread is blocked if the UMutex was previously locked by another thread. It is unblocked when unlock() is called.

On Unix (not yet tested on Windows), UMutex is recursive: the same thread can call multiple times lock() without being blocked.

Example:

 UMutex m; // Mutex shared with another thread(s).
 ...
 m.lock();
 // Data is protected here from the second thread
 //(assuming the second one protects also with the same mutex the same data).
 m.unlock();
See also:
USemaphore

Definition at line 54 of file UMutex.h.


Constructor & Destructor Documentation

UMutex::UMutex ( ) [inline]

The constructor.

Definition at line 62 of file UMutex.h.

virtual UMutex::~UMutex ( ) [inline, virtual]

Definition at line 75 of file UMutex.h.

UMutex::UMutex ( const UMutex M) [inline, private]

Definition at line 129 of file UMutex.h.


Member Function Documentation

int UMutex::lock ( ) const [inline]

Lock the mutex.

Definition at line 87 of file UMutex.h.

int UMutex::lockTry ( ) const [inline]

Definition at line 104 of file UMutex.h.

void UMutex::operator= ( UMutex M) [inline, private]

Definition at line 128 of file UMutex.h.

int UMutex::unlock ( ) const [inline]

Unlock the mutex.

Definition at line 113 of file UMutex.h.


Member Data Documentation

pthread_mutex_t UMutex::M [mutable, private]

Definition at line 126 of file UMutex.h.


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


find_object_2d
Author(s): Mathieu Labbe
autogenerated on Fri Feb 12 2016 01:18:18