posix/coil/Mutex.h
Go to the documentation of this file.
1 // -*- C++ -*-
20 #ifndef COIL_MUTEX_H
21 #define COIL_MUTEX_H
22 
23 #include <pthread.h>
24 
25 namespace coil
26 {
40  class Mutex
41  {
42  public:
62  Mutex(const char * const name = 0)
63  {
64  ::pthread_mutex_init(&mutex_, 0);
65  }
66 
83  {
84  ::pthread_mutex_destroy(&mutex_);
85  }
86 
102  inline void lock()
103  {
104  ::pthread_mutex_lock(&mutex_);
105  }
106 
122  inline bool trylock()
123  {
124  return ::pthread_mutex_trylock(&mutex_);
125  }
126 
142  inline void unlock()
143  {
144  ::pthread_mutex_unlock(&mutex_);
145  }
146 
159 
160  private:
161  Mutex(const Mutex&);
162  Mutex& operator=(const Mutex &);
163  };
164 };
165 #endif // COIL_MUTEX_H
ACE_thread_mutex_t mutex_
void lock()
Mutual exclusion lock.
~Mutex()
Destructor.
void unlock()
Mutual exclusion unlock.
bool trylock()
Mutual exclusion non-blocking lock.
Mutex(const char *const name=0)
Constructor.
HANDLE pthread_mutex_t
pthread_mutex_t mutex_
Mutual exclusion object.
Mutex(const char *naem=0)
Mutex & operator=(const Mutex &)
Common Object Interface Layer.


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Jun 6 2019 19:25:59