2 #include "common_std_thread.h"
8 unsigned& ref_debug_lock_counter()
10 static unsigned counter = 0;
14 mutex& ref_debug_mutex()
23 return ref_debug_lock_counter();
29 Mutex*& m_ptr = ((Mutex*&) pmutex);
36 Mutex*& m_ptr = ((Mutex*&) pmutex);
44 Mutex& m = *((Mutex*&) pmutex);
51 Mutex& m = *((Mutex*&) pmutex);
58 ref_debug_mutex().
lock();
60 ++ref_debug_lock_counter();
61 ref_debug_mutex().
unlock();
63 ref_debug_mutex().
lock();
64 std::cout << info <<
": received lock [" <<
this <<
"]" << std::endl;
65 ref_debug_mutex().
unlock();
71 ref_debug_mutex().
lock();
72 std::cout << info <<
": unlock [" <<
this <<
"]" << std::endl;
73 ref_debug_mutex().
unlock();
79 Mutex& m = *((Mutex*&) pmutex);
86 Mutex& m = *((Mutex*&) pmutex);
87 Condition*& c_ptr = (Condition*&) pcond;
88 c_ptr =
new Condition(m);
94 Condition*& c_ptr = (Condition*&) pcond;
101 Condition& c = *((Condition*&) pcond);
116 Condition& c = *((Condition*&) pcond);
~mutex()
destruct a mutex
Definition: mutex_pthread.h:33
void send_signal()
send the signal to unblock a thread waiting for the condition represented by this condition_mutex
Definition: mutex_pthread.h:92
void broadcast_signal_with_lock()
prefered approach to broadcast the signal and implemented as {lock();broadcast_signal();unlock();}
Definition: mutex_pthread.h:112
void unlock()
unlock the mutex
Definition: mutex_pthread.h:46
mutex()
construct a mutex
Definition: mutex_pthread.h:27
void debug_lock(const std::string &info)
same as lock but with printing debug information
Definition: mutex_pthread.h:52
void lock()
lock the mutex (if the mutex is already locked, the caller is blocked until the mutex becomes availab...
Definition: mutex_pthread.h:40
void broadcast_signal()
broadcast signal to unblock several threads waiting for the condition represented by this condition_m...
Definition: mutex_pthread.h:106
condition_mutex()
construct a mutex
Definition: mutex_pthread.h:80
void send_signal_with_lock()
prefered approach to send the signal and implemented as {lock();send_signal();unlock();}
Definition: mutex_pthread.h:98
~condition_mutex()
destruct a mutex
Definition: mutex_pthread.h:86
bool try_lock()
try to lock the mutex (return false if the mutex is still locked)
Definition: mutex_pthread.h:74
static unsigned get_debug_lock_counter()
return the global locking counter that is used for mutex debugging
Definition: mutex_pthread.h:21
the cgv namespace
Definition: vr_calib.cxx:9
void debug_unlock(const std::string &info)
same unlock but with printing debug information
Definition: mutex_pthread.h:64