UtiLite  0.3.1
A lite utilities library
Public Member Functions
UMutex Class Reference

#include <UMutex.h>

List of all members.

Public Member Functions

 UMutex ()
int lock () const
int unlock () const

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

Constructor & Destructor Documentation

UMutex::UMutex ( ) [inline]

The constructor.


Member Function Documentation

int UMutex::lock ( ) const [inline]

Lock the mutex.

int UMutex::unlock ( ) const [inline]

Unlock the mutex.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Friends Defines