forked from focus-creative-games/il2cpp_plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSemaphore.cpp
More file actions
85 lines (69 loc) · 1.52 KB
/
Semaphore.cpp
File metadata and controls
85 lines (69 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "os/c-api/il2cpp-config-platforms.h"
#include "os/Semaphore.h"
#if IL2CPP_SUPPORT_THREADS
#include "os/Atomic.h"
#if IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_POSIX
#include "os/Generic/SemaphoreImpl.h"
#else
#include "os/SemaphoreImpl.h"
#endif
namespace il2cpp
{
namespace os
{
Semaphore::Semaphore(int32_t initialValue, int32_t maximumValue)
: m_Semaphore(new SemaphoreImpl(initialValue, maximumValue))
{
}
Semaphore::~Semaphore()
{
delete m_Semaphore;
}
bool Semaphore::Post(int32_t releaseCount, int32_t* previousCount)
{
return m_Semaphore->Post(releaseCount, previousCount);
}
WaitStatus Semaphore::Wait(bool interruptible)
{
return m_Semaphore->Wait(interruptible);
}
WaitStatus Semaphore::Wait(uint32_t ms, bool interruptible)
{
return m_Semaphore->Wait(ms, interruptible);
}
void* Semaphore::GetOSHandle()
{
return m_Semaphore->GetOSHandle();
}
}
}
#else
namespace il2cpp
{
namespace os
{
Semaphore::Semaphore(int32_t initialValue, int32_t maximumValue)
{
}
Semaphore::~Semaphore()
{
}
bool Semaphore::Post(int32_t releaseCount, int32_t* previousCount)
{
return true;
}
WaitStatus Semaphore::Wait(bool interruptible)
{
return kWaitStatusSuccess;
}
WaitStatus Semaphore::Wait(uint32_t ms, bool interruptible)
{
return kWaitStatusSuccess;
}
void* Semaphore::GetOSHandle()
{
return NULL;
}
}
}
#endif