Etterna 0.74.4
Loading...
Searching...
No Matches
Threads_Win32.h
1#ifndef THREADS_WIN32_H
2#define THREADS_WIN32_H
3
4#include "Threads.h"
5#ifdef _WIN32
6#include <windows.h>
7#else
8#include <windef.h>
9#endif
10
12{
13 public:
14 HANDLE ThreadHandle;
15 DWORD ThreadId;
16
17 int (*m_pFunc)(void* pData);
18 void* m_pData;
19
20 void Halt(bool Kill);
21 void Resume();
22 uint64_t GetThreadId() const;
23 int Wait();
24};
25
26HANDLE
27Win32ThreadIdToHandle(uint64_t iID);
28
30{
31 friend class EventImpl_Win32;
32
33 public:
36
37 bool Lock();
38 bool TryLock();
39 void Unlock();
40
41 private:
42 HANDLE mutex;
43};
44
46{
47 public:
50
51 bool Wait(float timeout);
52 void Signal();
53 void Broadcast();
54 bool WaitTimeoutSupported() const { return true; }
55
56 private:
57 MutexImpl_Win32* m_pParent;
58
59 int m_iNumWaiting;
60 CRITICAL_SECTION m_iNumWaitingLock;
61 HANDLE m_WakeupSema;
62 HANDLE m_WaitersDone;
63};
64
66{
67 public:
68 SemaImpl_Win32(int iInitialValue);
70 int GetValue() const { return m_iCounter; }
71 void Post();
72 bool Wait();
73 bool TryWait();
74
75 private:
76 HANDLE sem;
77
78 // We have to track the count ourself, since Windows gives no way to query
79 // it.
80 int m_iCounter;
81};
82
83#endif
Definition Threads_Win32.h:46
Definition Threads.h:55
Definition Threads_Win32.h:30
Definition Threads.h:25
Definition RageThreads.h:232
Definition Threads_Win32.h:66
Definition Threads.h:65
Definition Threads_Win32.h:12
Definition Threads.h:9