ReactOS
0.4.16-dev-1020-gf135cab
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
_
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
f
i
l
m
o
p
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
x
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
Mutex.h
Go to the documentation of this file.
1
/*****************************************************************************
2
3
Mutex
4
5
*****************************************************************************/
6
7
8
#ifndef MUTEX_H
9
#define MUTEX_H
10
11
12
#include "
Unfrag.h
"
13
14
15
class
Mutex
16
{
17
public
:
18
Mutex
()
19
{
20
// NT only code begin ... Win9x disregards this part
21
SECURITY_ATTRIBUTES
MutexAttribs;
22
23
memset
(&MutexAttribs, 0,
sizeof
(
SECURITY_ATTRIBUTES
));
24
25
MutexAttribs.
bInheritHandle
=
false
;
26
MutexAttribs.
nLength
=
sizeof
(
SECURITY_ATTRIBUTES
);
27
MutexAttribs.
lpSecurityDescriptor
=
NULL
;
28
// NT only code end
29
30
Locked
=
false
;
31
LockCount
= 0;
32
MutexHandle
=
CreateMutex
(&MutexAttribs,
Locked
,
NULL
);
33
34
return
;
35
}
36
37
~Mutex
()
38
{
39
Lock
();
40
CloseHandle
(
MutexHandle
);
41
}
42
43
void
Lock
(
void
)
44
{
45
Locked
=
true
;
46
WaitForSingleObject
(
MutexHandle
,
INFINITE
);
47
LockCount
+= 1;
48
return
;
49
}
50
51
52
void
Unlock
(
void
)
53
{
54
LockCount
-= 1;
55
if
(
LockCount
<= 0)
56
{
57
LockCount
= 0;
58
Locked
=
false
;
59
}
60
61
ReleaseMutex
(
MutexHandle
);
62
return
;
63
}
64
65
66
bool
IsLocked
(
void
)
67
{
68
return
(
Locked
);
69
}
70
71
protected
:
72
uint32
LockCount
;
73
HANDLE
MutexHandle
;
74
bool
Locked
;
75
};
76
77
78
#endif
// MUTEX_H
Unfrag.h
uint32
unsigned int uint32
Definition:
types.h:32
Mutex
Definition:
Mutex.h:16
Mutex::Unlock
void Unlock(void)
Definition:
Mutex.h:52
Mutex::Locked
bool Locked
Definition:
Mutex.h:74
Mutex::Lock
void Lock(void)
Definition:
Mutex.h:43
Mutex::IsLocked
bool IsLocked(void)
Definition:
Mutex.h:66
Mutex::Mutex
Mutex()
Definition:
Mutex.h:18
Mutex::LockCount
uint32 LockCount
Definition:
Mutex.h:72
Mutex::~Mutex
~Mutex()
Definition:
Mutex.h:37
Mutex::MutexHandle
HANDLE MutexHandle
Definition:
Mutex.h:73
NULL
#define NULL
Definition:
types.h:112
CloseHandle
#define CloseHandle
Definition:
compat.h:739
SECURITY_ATTRIBUTES
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
INFINITE
#define INFINITE
Definition:
serial.h:102
void
Definition:
nsiface.idl:2307
memset
#define memset(x, y, z)
Definition:
compat.h:39
_SECURITY_ATTRIBUTES
Definition:
compat.h:191
_SECURITY_ATTRIBUTES::nLength
DWORD nLength
Definition:
compat.h:192
_SECURITY_ATTRIBUTES::bInheritHandle
BOOL bInheritHandle
Definition:
compat.h:194
_SECURITY_ATTRIBUTES::lpSecurityDescriptor
LPVOID lpSecurityDescriptor
Definition:
compat.h:193
WaitForSingleObject
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition:
synch.c:82
ReleaseMutex
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition:
synch.c:618
CreateMutex
#define CreateMutex
Definition:
winbase.h:3787
modules
rosapps
applications
fraginator
Mutex.h
Generated on Mon Apr 21 2025 06:07:04 for ReactOS by
1.9.6