Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
sem4.h
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#ifndef SEM4_HEADER
20#define SEM4_HEADER
21
22#include <limits.h>
23#ifndef _WINDOWS
24#include <unistd.h>
25#endif
26#include "wstypes.h"
27
28#ifdef _REENTRANT
29#ifndef _WINDOWS
30#include <semaphore.h>
31#else
32#include <windows.h>
33#endif // _WINDOWS
34#endif // _REENTRANT
35
36// Windows headers have a tendency to redefine IN
37#ifdef IN
38#undef IN
39#endif
40#define IN const
41
42class Sem4
43{
44 private:
45 #ifdef _REENTRANT
46#ifndef _WINDOWS
47 sem_t sem;
48#else
49 HANDLE sem;
50#endif
51 #endif
52 public:
53 Sem4();
55 ~Sem4();
56
57 sint32 Wait(void) const;
58 sint32 TryWait(void) const;
59 sint32 Post(void) const;
60 sint32 GetValue(int *sval) const;
61 sint32 Destroy(void);
62};
63
64#endif
void const char * value
unsigned long uint32
Definition bittype.h:46
signed long sint32
Definition bittype.h:51
Sem4()
Definition sem4.cpp:144
sint32 Wait(void) const
Definition sem4.cpp:156
sint32 GetValue(int *sval) const
Definition sem4.cpp:171
sint32 Destroy(void)
Definition sem4.cpp:176
sint32 Post(void) const
Definition sem4.cpp:161
~Sem4()
Definition sem4.cpp:152
sint32 TryWait(void) const
Definition sem4.cpp:166