OpenBarnyard
Loading...
Searching...
No Matches
TSemaphore_Win.cpp
Go to the documentation of this file.
1
#include "ToshiPCH.h"
2
#include "
TSemaphore_Win.h
"
3
4
#include <windows.h>
5
6
//-----------------------------------------------------------------------------
7
// Enables memory debugging.
8
// Note: Should be the last include!
9
//-----------------------------------------------------------------------------
10
#include "
Core/TMemoryDebugOn.h
"
11
12
TOSHI_NAMESPACE_START
13
14
TSemaphore::~TSemaphore
()
15
{
16
Destroy
();
17
}
18
19
TBOOL
TSemaphore::Poll
()
20
{
21
return
WaitForSingleObject( m_hSemaHnd, 0 ) == WAIT_OBJECT_0;
22
}
23
24
TBOOL
TSemaphore::Wait
()
25
{
26
return
WaitForSingleObject( m_hSemaHnd, INFINITE ) == WAIT_OBJECT_0;
27
}
28
29
// $Barnyard: FUNCTION 006bb640
30
TBOOL
TSemaphore::Signal
()
31
{
32
TASSERT
( m_hSemaHnd != NULL,
"Handle is NULL"
);
33
return
ReleaseSemaphore( m_hSemaHnd, 1, NULL );
34
}
35
36
TBOOL
TSemaphore::Destroy
()
37
{
38
return
TFALSE
;
39
}
40
41
TBOOL
TSemaphore::Create
(
TINT
a_iInitCount,
TINT
a_iMaxCount )
42
{
43
TASSERT
( a_iInitCount >= 0,
"Init count should be greater than zero"
);
44
TASSERT
( a_iMaxCount >= a_iInitCount,
"Init count cannot be less than max count"
);
45
46
m_hSemaHnd = CreateSemaphoreA( NULL, a_iInitCount, a_iMaxCount, NULL );
47
TASSERT
( m_hSemaHnd != NULL,
"Unable to create semaphore"
);
48
49
return
TTRUE
;
50
}
51
52
TOSHI_NAMESPACE_END
TMemoryDebugOn.h
TSemaphore_Win.h
TASSERT
#define TASSERT(X,...)
Definition
Defines.h:138
TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_START
Definition
Defines.h:47
TOSHI_NAMESPACE_END
#define TOSHI_NAMESPACE_END
Definition
Defines.h:50
TINT
int TINT
Definition
Typedefs.h:7
TFALSE
#define TFALSE
Definition
Typedefs.h:24
TTRUE
#define TTRUE
Definition
Typedefs.h:25
TBOOL
bool TBOOL
Definition
Typedefs.h:6
TSemaphore::Signal
TBOOL Signal()
Definition
TSemaphore_Win.cpp:30
TSemaphore::Create
TBOOL Create(TINT a_iInitCount, TINT a_iMaxCount)
Definition
TSemaphore_Win.cpp:41
TSemaphore::Destroy
TBOOL Destroy()
Definition
TSemaphore_Win.cpp:36
TSemaphore::Wait
TBOOL Wait()
Definition
TSemaphore_Win.cpp:24
TSemaphore::~TSemaphore
~TSemaphore()
Definition
TSemaphore_Win.cpp:14
TSemaphore::Poll
TBOOL Poll()
Definition
TSemaphore_Win.cpp:19
D:
_dev
OpenBarnyard
Source
Toshi
Source
Platform
Windows
TSemaphore_Win.cpp
Generated by
1.13.2