cgv
mutex.h
1 #pragma once
2 
3 #include <string>
4 
5 #include "lib_begin.h"
6 
7 namespace cgv {
8  namespace os {
9 
13 struct CGV_API mutex
14 {
15 protected:
16  void* pmutex;
17 public:
19  mutex();
21  ~mutex();
23  bool try_lock();
25  void lock();
27  void unlock();
29  void debug_lock(const std::string& info);
31  void debug_unlock(const std::string& info);
33  static unsigned get_debug_lock_counter();
34 };
35 
36 class thread;
37 
41 struct CGV_API condition_mutex : public mutex
42 {
43 protected:
44  void* pcond;
45  friend class thread;
46 public:
50  ~condition_mutex();
52  void send_signal();
54  void send_signal_with_lock();
56  void broadcast_signal();
58  void broadcast_signal_with_lock();
59 };
60 
61  }
62 }
63 
64 #include <cgv/config/lib_end.h>
cgv::os::thread
Definition: thread.h:39
cgv::os::mutex
Definition: mutex.h:14
cgv::os::condition_mutex
Definition: mutex.h:42
cgv
the cgv namespace
Definition: vr_calib.cxx:9