Richard Boegli's CnC_Generals_Zero_Hour Fork
WIP
This is documentation of Richard Boegil's Zero Hour Fork
Loading...
Searching...
No Matches
critsection.cpp
Go to the documentation of this file.
1
/*
2
** Command & Conquer Generals Zero Hour(tm)
3
** Copyright 2025 Electronic Arts Inc.
4
**
5
** This program is free software: you can redistribute it and/or modify
6
** it under the terms of the GNU General Public License as published by
7
** the Free Software Foundation, either version 3 of the License, or
8
** (at your option) any later version.
9
**
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
14
**
15
** You should have received a copy of the GNU General Public License
16
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
/***********************************************************************************************
20
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21
***********************************************************************************************
22
* *
23
* Project Name : critsection.cpp *
24
* *
25
* $Archive:: /Commando/Code/wwlib/critsection.cpp $*
26
* *
27
* Original Author:: Hector Yee *
28
* *
29
* $Author:: Hector_y $*
30
* *
31
* $Modtime:: 3/14/01 4:04p $*
32
* *
33
* $Revision:: 1 $*
34
* *
35
*---------------------------------------------------------------------------------------------*
36
* Functions: *
37
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
38
39
#include "
critsection.h
"
40
41
CriticalSectionClass::CriticalSectionClass
():
42
inside(
false
)
43
{
44
#ifndef _UNIX
45
InitializeCriticalSection(&Bar);
46
#endif
47
}
48
49
CriticalSectionClass::~CriticalSectionClass
()
50
{
51
#ifndef _UNIX
52
DeleteCriticalSection(&Bar);
53
#endif
54
}
55
56
void
CriticalSectionClass::Enter()
57
{
58
WWASSERT
(inside==
false
);
59
#ifndef _UNIX
60
EnterCriticalSection(&Bar);
61
inside=
true
;
62
#endif
63
}
64
65
void
CriticalSectionClass::Exit()
66
{
67
WWASSERT
(inside==
true
);
68
#ifndef _UNIX
69
inside=
false
;
70
LeaveCriticalSection(&Bar);
71
#endif
72
}
73
74
CriticalSectionClass::LockClass::LockClass
(
CriticalSectionClass
&c):
75
crit(c)
76
{
77
crit.Enter();
78
}
79
80
CriticalSectionClass::LockClass::~LockClass
()
81
{
82
crit.Exit();
83
}
WWASSERT
#define WWASSERT
Definition
aabtreebuilder.cpp:68
false
@ false
Definition
bool.h:59
CriticalSectionClass::LockClass::~LockClass
~LockClass()
Definition
critsection.cpp:80
CriticalSectionClass::LockClass::LockClass
LockClass(CriticalSectionClass &c)
Definition
critsection.cpp:74
CriticalSectionClass::CriticalSectionClass
CriticalSectionClass()
Definition
critsection.cpp:41
CriticalSectionClass::~CriticalSectionClass
~CriticalSectionClass()
Definition
critsection.cpp:49
critsection.h
Code
Libraries
Source
WWVegas
WWLib
critsection.cpp
Generated by
1.13.2