Mutex.
More...
#include <JMutex.hh>
Mutex.
Definition at line 95 of file JMutex.hh.
◆ JScopedLock
◆ JMutex()
JSYNCHRONIZATION::JMutex::JMutex |
( |
| ) |
|
|
inline |
Constructor.
Definition at line 104 of file JMutex.hh.
105 {
106 pthread_mutex_init(&
m_mutex, 0);
107 }
◆ ~JMutex()
JSYNCHRONIZATION::JMutex::~JMutex |
( |
| ) |
|
|
inline |
Destructor.
Definition at line 112 of file JMutex.hh.
113 {
114 pthread_mutex_destroy(&
m_mutex);
115 }
◆ lock()
int JSYNCHRONIZATION::JMutex::lock |
( |
| ) |
|
|
inline |
Lock the mutex.
- Returns
- 0 on success, an error code otherwise. See man 3p pthread_mutex_lock for further info.
Definition at line 122 of file JMutex.hh.
123 {
124 return pthread_mutex_lock(&
m_mutex);
125 }
◆ try_lock()
int JSYNCHRONIZATION::JMutex::try_lock |
( |
| ) |
|
|
inline |
Try lock the mutex.
- Returns
- 0 on success, an error code otherwise. See man 3p pthread_mutex_lock for further info.
Definition at line 132 of file JMutex.hh.
133 {
134 return pthread_mutex_trylock(&
m_mutex);
135 }
◆ unlock()
int JSYNCHRONIZATION::JMutex::unlock |
( |
| ) |
|
|
inline |
Unlock the mutex.
- Returns
- 0 on success, an error code otherwise. See man 3p pthread_mutex_lock for further info.
Definition at line 142 of file JMutex.hh.
143 {
144 return pthread_mutex_unlock(&
m_mutex);
145 }
◆ m_mutex
pthread_mutex_t JSYNCHRONIZATION::JMutex::m_mutex |
|
private |
The documentation for this class was generated from the following file: