forked from facebookarchive/RakNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSignaledEvent.h
69 lines (46 loc) · 1.07 KB
/
SignaledEvent.h
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
/*
* Copyright (c) 2014, Oculus VR, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#ifndef __SIGNALED_EVENT_H
#define __SIGNALED_EVENT_H
#if defined(_WIN32)
#include "WindowsIncludes.h"
#else
#include <pthread.h>
#include <sys/types.h>
#include "SimpleMutex.h"
#endif
#include "Export.h"
namespace RakNet
{
class RAK_DLL_EXPORT SignaledEvent
{
public:
SignaledEvent();
~SignaledEvent();
void InitEvent(void);
void CloseEvent(void);
void SetEvent(void);
void WaitOnEvent(int timeoutMs);
protected:
#ifdef _WIN32
HANDLE eventList;
#else
SimpleMutex isSignaledMutex;
bool isSignaled;
#if !defined(ANDROID)
pthread_condattr_t condAttr;
#endif
pthread_cond_t eventList;
pthread_mutex_t hMutex;
pthread_mutexattr_t mutexAttr;
#endif
};
} // namespace RakNet
#endif