csMutex Class Reference
A mutual-exclusion object. More...
#include <csutil/thread.h>
Inheritance diagram for csMutex:

Public Member Functions | |
virtual bool | LockWait ()=0 |
Lock the mutex. | |
virtual bool | LockTry ()=0 |
Lock the mutex if not already locked by some other entity. | |
virtual bool | Release ()=0 |
Unlock the mutex. | |
virtual char const * | GetLastError () const =0 |
Return the last error description, else 0 if there was none. | |
virtual bool | IsRecursive () const =0 |
Return true if the mutex is recursive. | |
Static Public Member Functions | |
csRef< csMutex > | Create (bool recursive=false) |
Create a mutex. |
Detailed Description
A mutual-exclusion object.A thread-safe lock. Mutexes are often used to control access to one or more resources shared by multiple threads of execution. A thread should access the shared resource(s) only after it has successfully locked the mutex; and it should unlock the mutex when it is done accessing the shared resource so that other threads may access it.
Definition at line 126 of file thread.h.
Member Function Documentation
|
Create a mutex.
|
|
Return the last error description, else 0 if there was none.
|
|
Return true if the mutex is recursive.
|
|
Lock the mutex if not already locked by some other entity. Does not suspend the thread waiting for the lock. If lock succeeded, returns true. If lock failed, immediately returns false. Each successful call to LockTry() must be balanced with a call to Release(). |
|
Lock the mutex. Suspends execution of the thread until the mutex can be locked. Each LockWait() must be balanced by a call to Release(). Returns true if locking succeeded. Returns false if locking failed for some catastrophic reason; check GetLastError(). |
|
Unlock the mutex. Each successful call to LockWait() or LockTry() must be balanced by a call to Release(). Returns true if unlocking succeeded. Returns false if unlocking failed for some catastrophic reason; check GetLastError(). |
The documentation for this class was generated from the following file:
- csutil/thread.h
Generated for Crystal Space by doxygen 1.3.9.1