Class UMutex

Class Documentation

class UMutex

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

Public Functions

inline UMutex()

The constructor.

inline virtual ~UMutex()
inline int lock() const

Lock the mutex.

inline int lockTry() const
inline int unlock() const

Unlock the mutex.