ETL
0.04.19
Main Page
Related Pages
Classes
Files
File List
File Members
ETL
_rwlock.h
Go to the documentation of this file.
1
25
/* === S T A R T =========================================================== */
26
27
#ifndef __ETL__RWLOCK_H_
28
#define __ETL__RWLOCK_H_
29
30
/* === H E A D E R S ======================================================= */
31
32
/* === M A C R O S ========================================================= */
33
34
/* === C L A S S E S & S T R U C T S ======================================= */
35
36
_ETL_BEGIN_NAMESPACE
37
38
class
read_write_lock
:
private
Mutex
39
{
40
public
:
41
42
read_write_lock
()
43
{ }
44
45
~read_write_lock
()
46
{ }
47
49
class
read_lock
50
{
51
read_write_lock
*
_mtx
;
52
public
:
53
read_lock
(
read_write_lock
&x):
_mtx
(&x) {
_mtx
->
lock_read
(); }
54
~read_lock
() {
_mtx
->
unlock_read
(); }
55
read_write_lock
&
get
() {
return
*
_mtx
; }
56
};
57
59
class
write_lock
60
{
61
read_write_lock
*
_mtx
;
62
public
:
63
write_lock
(
read_write_lock
&x):
_mtx
(&x) {
_mtx
->
lock_write
(); }
64
~read_lock
() {
_mtx
->
unlock_write
(); }
65
read_write_lock
&
get
() {
return
*
_mtx
; }
66
};
67
68
void
lock_read
(
void
)
69
{ lock_mutex(); }
70
71
void
lock_write
(
void
)
72
{ lock_mutex(); }
73
74
bool
try_lock_read
(
void
)
75
{
return
try_lock_mutex(); }
76
77
bool
try_lock_write
(
void
)
78
{
return
try_lock_mutex(); }
79
80
void
unlock_write
(
void
)
81
{ unlock_mutex(); }
82
83
void
unlock_read
(
void
)
84
{ unlock_mutex(); }
85
};
86
87
_ETL_END_NAMESPACE
88
89
/* === E X T E R N S ======================================================= */
90
91
/* === E N D =============================================================== */
92
93
#endif
Generated on Mon Nov 16 2015 15:32:03 for ETL by
1.8.1.2