mutex_w32.hpp
Go to the documentation of this file.
1 
10 /*****************************************************************************
11 ** Ifdefs
12 *****************************************************************************/
13 
14 #ifndef ECL_THREADS_MUTEX_W32_HPP_
15 #define ECL_THREADS_MUTEX_W32_HPP_
16 
17 /*****************************************************************************
18 ** Platform Check
19 *****************************************************************************/
20 
21 #include <ecl/config/ecl.hpp>
22 #if defined(ECL_IS_WIN32)
23 
24 /*****************************************************************************
25 ** Includes
26 *****************************************************************************/
27 
28 #include <windows.h>
29 #include <ecl/time/duration.hpp>
30 #include "macros.hpp"
31 
32 
33 /*****************************************************************************
34 ** Namespaces
35 *****************************************************************************/
36 
37 namespace ecl {
38 
39 /*****************************************************************************
40 ** Typedefs
41 *****************************************************************************/
42 
43 typedef CRITICAL_SECTION RawMutex;
45 /*****************************************************************************
46 ** Class Mutex
47 *****************************************************************************/
58 class ecl_threads_PUBLIC Mutex {
59 public:
67  Mutex(const bool locked = false);
73  virtual ~Mutex();
74 
80  void unlock();
86  void lock();
98  bool trylock(Duration &duration);
107  bool trylock();
117  unsigned int locks() { return number_locks; }
118 
125  RawMutex& rawType() { return mutex; }
126 
127 private:
128  RawMutex mutex;
129  unsigned int number_locks;
130 
131 };
132 
133 }; // namespace ecl
134 
135 
136 #endif /* ECL_IS_WIN32 */
137 #endif /* ECL_THREADS_MUTEX_W32_HPP_ */
#define ecl_threads_PUBLIC
Definition: macros.hpp:37
Embedded control libraries.
TimeStamp Duration
ecl::Mutex mutex


ecl_threads
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:44