少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
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
#include "il2cpp-config.h"
 
#if IL2CPP_THREADS_WIN32
 
#include "EventImpl.h"
#include "WindowsHelpers.h"
 
namespace il2cpp
{
namespace os
{
    EventImpl::EventImpl(bool manualReset, bool signaled)
    {
        m_Event = ::CreateEvent(NULL, manualReset ? TRUE : FALSE, signaled ? TRUE : FALSE, NULL);
 
        IL2CPP_ASSERT(m_Event);
    }
 
    EventImpl::~EventImpl()
    {
        IL2CPP_ASSERT(m_Event);
 
        ::CloseHandle(m_Event);
    }
 
    ErrorCode EventImpl::Set()
    {
        if (::SetEvent(m_Event))
            return kErrorCodeSuccess;
 
        return kErrorCodeGenFailure;
    }
 
    ErrorCode EventImpl::Reset()
    {
        if (::ResetEvent(m_Event))
            return kErrorCodeSuccess;
 
        return kErrorCodeGenFailure;
    }
 
    WaitStatus EventImpl::Wait(bool interruptible)
    {
        return Wait(INFINITE, interruptible);
    }
 
    WaitStatus EventImpl::Wait(uint32_t ms, bool interruptible)
    {
        return il2cpp::os::win::WaitForSingleObjectAndAccountForAPCs(m_Event, ms, interruptible);
    }
 
    void* EventImpl::GetOSHandle()
    {
        return (void*)m_Event;
    }
}
}
 
#endif