summaryrefslogtreecommitdiff
path: root/src/thread.cc
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.cc
parent70e08d1325b2cdd0e9c16a193cc6ed10d2d21617 (diff)
Replace obsolete WIN32 ifdefs with platform define.
Diffstat (limited to 'src/thread.cc')
-rw-r--r--src/thread.cc31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/thread.cc b/src/thread.cc
index 030c5dd..abc59a2 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -26,7 +26,6 @@
*/
#include "thread.h"
-#include <stdio.h>
#include <hugin.hpp>
Thread::Thread()
@@ -37,32 +36,32 @@ Thread::~Thread()
void Thread::run()
{
- DEBUG(thread, "Thread::run()\n");
-#ifdef WIN32
- tid = CreateThread(NULL, 0, thread_run, this, 0, NULL);
+ DEBUG(thread, "Thread::run()\n");
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
+ tid = CreateThread(NULL, 0, thread_run, this, 0, NULL);
#else
- pthread_create(&tid, NULL, thread_run, this);
-#endif/*WIN32*/
+ pthread_create(&tid, NULL, thread_run, this);
+#endif
}
void Thread::wait_stop()
{
-#ifdef WIN32
- WaitForSingleObject(tid, INFINITE);
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
+ WaitForSingleObject(tid, INFINITE);
#else
- pthread_join(tid, NULL);
-#endif/*WIN32*/
+ pthread_join(tid, NULL);
+#endif
}
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
DWORD WINAPI
#else
void*
-#endif/*WIN32*/
+#endif
Thread::thread_run(void *data)
{
- DEBUG(thread, "Thread run\n");
- Thread *t = (Thread*)data;
- t->thread_main();
- return 0;
+ DEBUG(thread, "Thread run\n");
+ Thread *t = (Thread*)data;
+ t->thread_main();
+ return 0;
}