synfig-core
1.0.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
synfig
mutex.h
Go to the documentation of this file.
1
/* === S Y N F I G ========================================================= */
21
/* ========================================================================= */
22
23
/* === S T A R T =========================================================== */
24
25
#ifndef __SYNFIG_MUTEX_H
26
#define __SYNFIG_MUTEX_H
27
28
/* === H E A D E R S ======================================================= */
29
30
/* === M A C R O S ========================================================= */
31
32
/* === T Y P E D E F S ===================================================== */
33
34
/* === C L A S S E S & S T R U C T S ======================================= */
35
36
namespace
synfig {
37
38
class
RecMutex;
39
40
class
Mutex
41
{
42
friend
class
RecMutex
;
43
44
protected
:
45
void
*
blackbox
;
46
47
public
:
48
49
class
Lock
50
{
51
Mutex
& mutex;
52
public
:
53
Lock
(
Mutex
& x):mutex(x) { mutex.
lock
(); }
54
~Lock
() { mutex.
unlock
(); }
55
};
56
57
Mutex
();
58
~Mutex
();
59
60
void
lock
();
61
void
unlock
();
62
bool
try_lock
();
63
bool
is_locked
();
64
65
private
:
67
Mutex
(
const
Mutex
&);
68
70
void
operator=(
const
Mutex
&);
71
};
72
73
class
RecMutex
:
public
Mutex
74
{
75
public
:
76
RecMutex
();
77
78
void
unlock_all
();
79
};
80
81
class
RWLock
82
{
83
void
* blackbox;
84
85
public
:
86
87
class
ReaderLock
88
{
89
RWLock
& rw_lock;
90
public
:
91
ReaderLock
(
RWLock
& x):rw_lock(x) { rw_lock.
reader_lock
(); }
92
~ReaderLock
() { rw_lock.
reader_unlock
(); }
93
};
94
class
WriterLock
95
{
96
RWLock
& rw_lock;
97
public
:
98
WriterLock
(
RWLock
& x):rw_lock(x) { rw_lock.
writer_lock
(); }
99
~WriterLock
() { rw_lock.
writer_unlock
(); }
100
};
101
102
RWLock
();
103
~RWLock
();
104
105
void
reader_lock
();
106
void
reader_unlock
();
107
bool
reader_trylock
();
108
109
void
writer_lock
();
110
void
writer_unlock
();
111
bool
writer_trylock
();
112
};
113
114
};
// END of namespace synfig
115
116
/* === E N D =============================================================== */
117
118
#endif
Generated on Mon Nov 16 2015 15:33:47 for synfig-core by
1.8.1.2