Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

Mutex Class Reference

Mutual exclusion device. More...

#include <cxxtools/mutex.h>

Inheritance diagram for Mutex:

List of all members.

Public Member Functions

 Mutex ()
 Default constructor.
 ~Mutex ()
 Destructor.
void lock ()
 Lock the mutex.
bool tryLock ()
void unlock ()
 Unlocks the mutex.
bool unlockNoThrow ()
 Unlocks the mutex.
MutexImpl & impl ()


Detailed Description

A Mutex is a mutual exclusion device. It is used to synchronize the access to data which is accessed by more than one thread or process at the same time. Mutexes are not recursive, that is the same thread can not lock a mutex multiple times without deadlocking.

Constructor & Destructor Documentation

~Mutex (  ) 

The destructor destroys the mutex. The mutex must be in unlocked state when the destructor is called.


Member Function Documentation

void lock (  ) 

If the mutex is currently locked by another thread, the calling thread suspends until no other thread holds a lock on it. If the mutex is already locked by the calling thread a deadlock occurs.

bool unlockNoThrow (  ) 

This method does not throw an exception if unlocking the mutex fails but simply returns false.

Referenced by MutexLock::~MutexLock().

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6