Jpp  15.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Attributes | List of all members
JSYNCHRONIZATION::JMutex Class Reference

Mutex. More...

#include <JMutex.hh>

Public Types

typedef JBasicScopedLock< JMutexJScopedLock
 

Public Member Functions

 JMutex ()
 Constructor. More...
 
 ~JMutex ()
 Destructor. More...
 
int lock ()
 Lock the mutex. More...
 
int try_lock ()
 Try lock the mutex. More...
 
int unlock ()
 Unlock the mutex. More...
 

Private Attributes

pthread_mutex_t m_mutex
 

Detailed Description

Mutex.

Definition at line 92 of file JMutex.hh.

Member Typedef Documentation

Definition at line 144 of file JMutex.hh.

Constructor & Destructor Documentation

JSYNCHRONIZATION::JMutex::JMutex ( )
inline

Constructor.

Definition at line 101 of file JMutex.hh.

102  {
103  pthread_mutex_init(&m_mutex, 0);
104  }
pthread_mutex_t m_mutex
Definition: JMutex.hh:94
JSYNCHRONIZATION::JMutex::~JMutex ( )
inline

Destructor.

Definition at line 109 of file JMutex.hh.

110  {
111  pthread_mutex_destroy(&m_mutex);
112  }
pthread_mutex_t m_mutex
Definition: JMutex.hh:94

Member Function Documentation

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 119 of file JMutex.hh.

120  {
121  return pthread_mutex_lock(&m_mutex);
122  }
pthread_mutex_t m_mutex
Definition: JMutex.hh:94
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 129 of file JMutex.hh.

130  {
131  return pthread_mutex_trylock(&m_mutex);
132  }
pthread_mutex_t m_mutex
Definition: JMutex.hh:94
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 139 of file JMutex.hh.

140  {
141  return pthread_mutex_unlock(&m_mutex);
142  }
pthread_mutex_t m_mutex
Definition: JMutex.hh:94

Member Data Documentation

pthread_mutex_t JSYNCHRONIZATION::JMutex::m_mutex
private

Definition at line 94 of file JMutex.hh.


The documentation for this class was generated from the following file: