mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Fix C++11 Windows build of threading code
The initial problem was that mutex_auto_lock.h tries to use std::unique_lock<std::mutex> 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.
This commit is contained in:
@@ -32,9 +32,6 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include "threads.h"
|
||||
|
||||
#include <string>
|
||||
#if USE_CPP11_THREADS
|
||||
#include <thread> // for std::thread
|
||||
#endif
|
||||
#ifdef _AIX
|
||||
#include <sys/thread.h> // for tid_t
|
||||
#endif
|
||||
@@ -157,9 +154,11 @@ private:
|
||||
Atomic<bool> 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);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user