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
76 lines (62 loc) · 1.95 KB
/
Semaphore.cpp
File metadata and controls
76 lines (62 loc) · 1.95 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
#include "il2cpp-config.h"
#if !RUNTIME_TINY
#include "os/c-api/Semaphore-c-api.h"
#include "os/Semaphore.h"
extern "C"
{
UnityPalSemaphore* UnityPalSemaphoreNew(int32_t manualReset, int32_t signaled)
{
return new il2cpp::os::Semaphore(manualReset, signaled);
}
void UnityPalSemaphoreDelete(UnityPalSemaphore* semaphore)
{
IL2CPP_ASSERT(semaphore);
delete semaphore;
}
int32_t UnityPalSemaphorePost(UnityPalSemaphore* semaphore, int32_t releaseCount, int32_t* previousCount)
{
IL2CPP_ASSERT(semaphore);
return semaphore->Post(releaseCount, previousCount);
}
UnityPalWaitStatus UnityPalSemaphoreWait(UnityPalSemaphore* semaphore, int32_t interruptible)
{
IL2CPP_ASSERT(semaphore);
return semaphore->Wait((bool)interruptible);
}
UnityPalWaitStatus UnityPalSemaphoreWaitMs(UnityPalSemaphore* semaphore, uint32_t ms, int32_t interruptible)
{
IL2CPP_ASSERT(semaphore);
return semaphore->Wait(ms, interruptible);
}
UnityPalSemaphoreHandle* UnityPalSemaphoreHandleNew(UnityPalSemaphore* semaphore)
{
IL2CPP_ASSERT(semaphore);
return new UnityPalSemaphoreHandle(semaphore);
}
void UnityPalSemaphoreHandleDelete(UnityPalSemaphoreHandle* handle)
{
IL2CPP_ASSERT(handle);
delete handle;
}
int32_t UnityPalSemaphoreHandleWait(UnityPalSemaphoreHandle* handle)
{
IL2CPP_ASSERT(handle);
return handle->Wait();
}
int32_t UnityPalSemaphoreHandleWaitMs(UnityPalSemaphoreHandle* handle, uint32_t ms)
{
IL2CPP_ASSERT(handle);
return handle->Wait(ms);
}
void UnityPalSemaphoreHandleSignal(UnityPalSemaphoreHandle* handle)
{
IL2CPP_ASSERT(handle);
handle->Signal();
}
UnityPalSemaphore* UnityPalSemaphoreHandleGet(UnityPalSemaphoreHandle* handle)
{
IL2CPP_ASSERT(handle);
return &handle->Get();
}
}
#endif