cgv
Loading...
Searching...
No Matches
mutex.h
1#pragma once
2
3#include <string>
4
5#include "lib_begin.h"
6
7namespace cgv {
8 namespace os {
9
13struct CGV_API mutex
14{
15protected:
16 void* pmutex;
17public:
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
36class thread;
37
41struct CGV_API condition_mutex : public mutex
42{
43protected:
44 void* pcond;
45 friend class thread;
46public:
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>
Thread class implementation that uses pthreads internally.
Definition thread.h:39
the cgv namespace
Definition print.h:11
A mutex that can wake up other threads by signals sent when a condition is fulfilled.
Definition mutex.h:42
A simple mutex (mutual exclusion) for solving thread synchronisation problems.
Definition mutex.h:14