#include <mutex.hpp>
The mutex class is a synchronization primitive that can be used to protect shared data from being simultaneously accessed by multiple threads.
- Author
- herbert koelman
- Date
- 18/3/2016
- Examples:
- synchronized_queue_tests.cpp.
Definition at line 37 of file mutex.hpp.
void pthread::mutex::lock |
( |
| ) |
|
The mutex object is locked (by calling pthread_mutex_lock). If the mutex is already locked, the calling thread blocks until the mutex becomes available. This operation returns with the mutex object referenced by mutex in the locked state with the calling thread as its owner.
- Exceptions
-
Definition at line 24 of file mutex.cpp.
void pthread::mutex::try_lock |
( |
| ) |
|
The function pthread_mutex_trylock is identical to pthread_mutex_lock except tha if the mutex object referenced by mutex is currently locked (by any thread, including the current thread), the call returns immediately.
- Exceptions
-
- See also
- lock
Definition at line 32 of file mutex.cpp.
void pthread::mutex::unlock |
( |
| ) |
|
The pthread_mutex_unlock function releases the mutex object referenced by mutex. The manner in which a mutex is released is dependent upon the mutex's type attribute. If there are threads blocked on the mutex object referenced by mutex when unlock is called, resulting in the mutex becoming available, the scheduling policy is used to determine which thread shall acquire the mutex.
- Exceptions
-
Definition at line 40 of file mutex.cpp.
pthread_mutex_t pthread::mutex::_mutex |
|
protected |
pthread mutex structure
Definition at line 74 of file mutex.hpp.
The documentation for this class was generated from the following files: