summaryrefslogtreecommitdiff
path: root/src/thread.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-02-17 15:00:52 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-02-17 15:30:16 +0100
commit4363187d4e86c63d9465cbe7296d11fdc7815e32 (patch)
tree33005bd8183d74825b44bc4d47680faf7df009f0 /src/thread.h
parent70e08d1325b2cdd0e9c16a193cc6ed10d2d21617 (diff)
Replace obsolete WIN32 ifdefs with platform define.
Diffstat (limited to 'src/thread.h')
-rw-r--r--src/thread.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/thread.h b/src/thread.h
index 6d3b920..f5bf1a7 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -26,31 +26,34 @@
*/
#pragma once
-#ifdef WIN32
+#include "platform.h"
+
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <pthread.h>
-#endif/*WIN32*/
+#endif
-class Thread {
+class Thread
+{
public:
- Thread();
- virtual ~Thread();
+ Thread();
+ virtual ~Thread();
- void run();
- void wait_stop();
+ void run();
+ void wait_stop();
protected:
- virtual void thread_main() = 0;
-
+ virtual void thread_main() = 0;
+
private:
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
HANDLE tid{nullptr};
- static DWORD WINAPI
+ static DWORD WINAPI
#else
- pthread_t tid{0};
- static void*
-#endif/*WIN32*/
- thread_run(void *data);
+ pthread_t tid{0};
+ static void*
+#endif
+ thread_run(void *data);
};