blob: 13414c22e0aaf74a4ba024bdd48857c4c5542895 (
plain) (
blame)
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
|
#pragma once
#include "WAVM/Inline/BasicTypes.h"
#include "WAVM/Inline/Time.h"
#include "WAVM/Platform/Defines.h"
namespace WAVM { namespace Platform {
// Platform-independent events.
struct Event
{
WAVM_API Event();
WAVM_API ~Event();
// Don't allow copying or moving an Event.
Event(const Event&) = delete;
Event(Event&&) = delete;
void operator=(const Event&) = delete;
void operator=(Event&&) = delete;
// Wait for the event to be signaled. Cancels the wait after waitDuration has elapsed.
// Returns true if the event was signaled, false if the wait was cancelled.
WAVM_API bool wait(Time waitDuration);
WAVM_API void signal();
private:
#ifdef WIN32
void* handle;
#elif defined(__linux__) && defined(__x86_64__)
struct PthreadMutex
{
Uptr data[5];
} pthreadMutex;
struct PthreadCond
{
Uptr data[6];
} pthreadCond;
#elif defined(__linux__) && defined(__aarch64__)
struct PthreadMutex
{
Uptr data[6];
} pthreadMutex;
struct PthreadCond
{
Uptr data[6];
} pthreadCond;
#elif defined(__APPLE__)
struct PthreadMutex
{
Uptr data[8];
} pthreadMutex;
struct PthreadCond
{
Uptr data[6];
} pthreadCond;
#elif defined(__WAVIX__)
struct PthreadMutex
{
Uptr data[6];
} pthreadMutex;
struct PthreadCond
{
Uptr data[12];
} pthreadCond;
#else
#error unsupported platform
#endif
};
}}
|