csMutex Class ReferenceA mutual-exclusion object. More...
Inheritance diagram for csMutex:
Public Member Functions
|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. |
|virtual bool||LockTry ()=0|
|Lock the mutex if not already locked by some other entity. |
|virtual bool||LockWait ()=0|
|Lock the mutex. |
|virtual bool||Release ()=0|
|Unlock the mutex. |
Static Public Member Functions
|static csRef< csMutex >||Create (bool recursive=false)|
|Create a mutex. |
Detailed DescriptionA 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.
Member Function Documentation
Create a mutex.
recursive If true, the same thread can lock the mutex even when it already holds the lock without deadlocking. If false, then recursive locking within the same thread is not supported, and will probably deadlock.
- The new mutex.
- On Windows, mutexes always exhibit recursive semantics, however, for best portability, you should still choose an appropriate value for recursive. On other platforms, such as GNU/Linux, non-recursive threads may be the default since they are can be implemented more efficiently.
|virtual char const* csMutex::GetLastError||(||)|| const
Return the last error description, else 0 if there was none.
|virtual bool csMutex::IsRecursive||(||)|| const
Return true if the mutex is recursive.
|virtual bool csMutex::LockTry||(||)||
|virtual bool csMutex::LockWait||(||)||
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().
Referenced by csScopedMutexLock::csScopedMutexLock().
|virtual bool csMutex::Release||(||)||
The documentation for this class was generated from the following file:
Generated for Crystal Space 1.0.2 by doxygen 1.4.7