ace/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 <coil/config_coil.h>
24 #if defined (WIN32)
25 #pragma warning( disable : 4244 )
26 #pragma warning( disable : 4312 )
27 #endif
28 #include <ace/OS_NS_Thread.h>
29 #if defined (WIN32)
30 #pragma warning( default : 4244 )
31 #pragma warning( default : 4312 )
32 #endif
33 
34 namespace coil
35 {
36  class Mutex
37  {
38  public:
39  Mutex(const char* naem = 0)
40  {
41  ACE_OS::thread_mutex_init(&mutex_, 0);
42  }
43 
45  {
46  ACE_OS::thread_mutex_destroy(&mutex_);
47  }
48 
49  inline void lock()
50  {
51  ACE_OS::thread_mutex_lock(&mutex_);
52  }
53 
54  inline bool trylock()
55  {
56  return ACE_OS::thread_mutex_trylock(&mutex_);
57  }
58 
59  inline void unlock()
60  {
61  ACE_OS::thread_mutex_unlock(&mutex_);
62  }
63  ACE_thread_mutex_t mutex_;
64 
65  private:
66  Mutex(const Mutex&);
67  Mutex& operator=(const Mutex &);
68  };
69 };
70 #endif // COIL_MUTEX_H
ACE_thread_mutex_t mutex_
bool trylock()
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