From 0a16e53b40d347db7dcd04cb694d0f8f2ed1a5a7 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 6 Oct 2016 21:13:04 +0200 Subject: Fix C++11 Windows build of threading code The initial problem was that mutex_auto_lock.h tries to use std::unique_lock despite mutex.h not using C++11's std::mutex on Windows. The problem here is the mismatch between C++11 usage conditions of the two headers. This commit moves the decision logic to threads.h and makes sure mutex.h, mutex_auto_lock.h and event.h all use the same features. --- src/threading/thread.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/threading/thread.h') diff --git a/src/threading/thread.h b/src/threading/thread.h index de800ecb7..14a0e13ab 100644 --- a/src/threading/thread.h +++ b/src/threading/thread.h @@ -32,9 +32,6 @@ DEALINGS IN THE SOFTWARE. #include "threads.h" #include -#if USE_CPP11_THREADS - #include // for std::thread -#endif #ifdef _AIX #include // for tid_t #endif @@ -157,9 +154,11 @@ private: Atomic m_running; Mutex m_mutex; -#ifndef USE_CPP11_THREADS +#if USE_CPP11_THREADS + std::thread *m_thread_obj; +#else threadhandle_t m_thread_handle; -# if _WIN32 +# if USE_WIN_THREADS threadid_t m_thread_id; # endif #endif @@ -172,10 +171,6 @@ private: tid_t m_kernel_thread_id; #endif -#if USE_CPP11_THREADS - std::thread *m_thread_obj; -#endif - DISABLE_CLASS_COPY(Thread); }; -- cgit v1.2.3