summaryrefslogtreecommitdiff
path: root/src/threading/thread.h
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-06-08 10:40:11 +0200
committerGitHub <noreply@github.com>2017-06-08 10:40:11 +0200
commit5bd33a158688f5fb950613278eefb95b0594a765 (patch)
treeaeeb82fafbc6559b68077f116df7200a63def657 /src/threading/thread.h
parent0a5c3c28522f512f31dae3091668126c1eae787d (diff)
downloadminetest-5bd33a158688f5fb950613278eefb95b0594a765.tar.gz
minetest-5bd33a158688f5fb950613278eefb95b0594a765.tar.bz2
minetest-5bd33a158688f5fb950613278eefb95b0594a765.zip
C++11 patchset 5: use std::threads and remove old compat layer (#5928)
* C++11 patchset 5: use std::threads and remove old compat layer * use pragma once in modified headers * use C++11 function delete for object copy
Diffstat (limited to 'src/threading/thread.h')
-rw-r--r--src/threading/thread.h24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/threading/thread.h b/src/threading/thread.h
index ab943f094..6292d9ed7 100644
--- a/src/threading/thread.h
+++ b/src/threading/thread.h
@@ -23,8 +23,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
-#ifndef THREADING_THREAD_H
-#define THREADING_THREAD_H
+#pragma once
#include "util/basic_macros.h"
#include "threads.h"
@@ -93,17 +92,8 @@ public:
inline bool isRunning() { return m_running; }
inline bool stopRequested() { return m_request_stop; }
-#if USE_CPP11_THREADS
inline threadid_t getThreadId() { return m_thread_obj->get_id(); }
inline threadhandle_t getThreadHandle() { return m_thread_obj->native_handle(); }
-#else
-# if USE_WIN_THREADS
- inline threadid_t getThreadId() { return m_thread_id; }
-# else
- inline threadid_t getThreadId() { return m_thread_handle; }
-# endif
- inline threadhandle_t getThreadHandle() { return m_thread_handle; }
-#endif
/*
* Gets the thread return value.
@@ -156,14 +146,7 @@ private:
std::mutex m_mutex;
std::mutex m_start_finished_mutex;
-#if USE_CPP11_THREADS
std::thread *m_thread_obj;
-#else
- threadhandle_t m_thread_handle;
-# if USE_WIN_THREADS
- threadid_t m_thread_id;
-# endif
-#endif
static ThreadStartFunc threadProc;
@@ -172,9 +155,6 @@ private:
// available to us, so we maintain one ourselves. This is set on thread start.
tid_t m_kernel_thread_id;
#endif
-
- DISABLE_CLASS_COPY(Thread);
+ Thread(const Thread &) = delete;
};
-#endif
-