SLikeNet  0.1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SignaledEvent.h
Go to the documentation of this file.
1 /*
2  * Original work: Copyright (c) 2014, Oculus VR, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7  * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8  *
9  *
10  * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11  *
12  * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13  * license found in the license.txt file in the root directory of this source tree.
14  */
15 
16 #ifndef __SIGNALED_EVENT_H
17 #define __SIGNALED_EVENT_H
18 
19 
20 
21 #if defined(_WIN32)
22 #include "WindowsIncludes.h"
23 
24 
25 
26 #else
27  #include <pthread.h>
28  #include <sys/types.h>
29  #include "SimpleMutex.h"
30 
31 
32 
33 
34 #endif
35 
36 #include "Export.h"
37 
38 namespace SLNet
39 {
40 
42 {
43 public:
44  SignaledEvent();
45  ~SignaledEvent();
46 
47  void InitEvent(void);
48  void CloseEvent(void);
49  void SetEvent(void);
50  void WaitOnEvent(int timeoutMs);
51 
52 protected:
53 #ifdef _WIN32
54  HANDLE eventList;
55 
56 
57 
58 
59 
60 #else
62  bool isSignaled;
63 #if !defined(ANDROID)
64  pthread_condattr_t condAttr;
65 #endif
66  pthread_cond_t eventList;
67  pthread_mutex_t hMutex;
68  pthread_mutexattr_t mutexAttr;
69 #endif
70 };
71 
72 } // namespace SLNet
73 
74 #endif