summaryrefslogtreecommitdiff
path: root/src/itemdef.cpp
diff options
context:
space:
mode:
authorShadowNinja <ShadowNinja@users.noreply.github.com>2017-06-11 03:43:05 -0400
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-06-11 09:43:05 +0200
commit6c5e5e202394ce8063e3c2d9b663145bc4f8efce (patch)
tree2916ed7f7fc19c934fe5f614a9eeb1a282f13081 /src/itemdef.cpp
parent5cc8ad946efb3612eb6ea8655780b29fe4c62e19 (diff)
downloadminetest-6c5e5e202394ce8063e3c2d9b663145bc4f8efce.tar.gz
minetest-6c5e5e202394ce8063e3c2d9b663145bc4f8efce.tar.bz2
minetest-6c5e5e202394ce8063e3c2d9b663145bc4f8efce.zip
Remove threads.h and replace its definitions with their C++11 equivalents (#5957)
This also changes threadProc's signature, since C++11 supports arbitrary thread function signatures.
Diffstat (limited to 'src/itemdef.cpp')
-rw-r--r--src/itemdef.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/itemdef.cpp b/src/itemdef.cpp
index 53b6e04cd..f1cc03c4b 100644
--- a/src/itemdef.cpp
+++ b/src/itemdef.cpp
@@ -245,7 +245,7 @@ public:
{
#ifndef SERVER
- m_main_thread = thr_get_current_thread_id();
+ m_main_thread = std::this_thread::get_id();
#endif
clear();
}
@@ -320,7 +320,7 @@ public:
<<name<<"\""<<std::endl;
// This is not thread-safe
- sanity_check(thr_is_current_thread(m_main_thread));
+ sanity_check(std::this_thread::get_id() == m_main_thread);
// Skip if already in cache
ClientCached *cc = NULL;
@@ -356,15 +356,12 @@ public:
{
ClientCached *cc = NULL;
m_clientcached.get(name, &cc);
- if(cc)
+ if (cc)
return cc;
- if(thr_is_current_thread(m_main_thread))
- {
+ if (std::this_thread::get_id() == m_main_thread) {
return createClientCachedDirect(name, client);
- }
- else
- {
+ } else {
// We're gonna ask the result to be put into here
static ResultQueue<std::string, ClientCached*, u8, u8> result_queue;
@@ -580,7 +577,7 @@ private:
StringMap m_aliases;
#ifndef SERVER
// The id of the thread that is allowed to use irrlicht directly
- threadid_t m_main_thread;
+ std::thread::id m_main_thread;
// A reference to this can be returned when nothing is found, to avoid NULLs
mutable ClientCached m_dummy_clientcached;
// Cached textures and meshes