aboutsummaryrefslogtreecommitdiff
path: root/src/client
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/client
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/client')
-rw-r--r--src/client/tile.cpp12
-rw-r--r--src/client/tile.h1
2 files changed, 6 insertions, 7 deletions
diff --git a/src/client/tile.cpp b/src/client/tile.cpp
index 10a9d5f0d..e47a40ea1 100644
--- a/src/client/tile.cpp
+++ b/src/client/tile.cpp
@@ -386,7 +386,7 @@ public:
private:
// The id of the thread that is allowed to use irrlicht directly
- threadid_t m_main_thread;
+ std::thread::id m_main_thread;
// The irrlicht device
IrrlichtDevice *m_device;
@@ -445,7 +445,7 @@ TextureSource::TextureSource(IrrlichtDevice *device):
{
assert(m_device); // Pre-condition
- m_main_thread = thr_get_current_thread_id();
+ m_main_thread = std::this_thread::get_id();
// Add a NULL TextureInfo as the first index, named ""
m_textureinfo_cache.push_back(TextureInfo(""));
@@ -508,7 +508,7 @@ u32 TextureSource::getTextureId(const std::string &name)
/*
Get texture
*/
- if (thr_is_current_thread(m_main_thread))
+ if (std::this_thread::get_id() == m_main_thread)
{
return generateTexture(name);
}
@@ -616,7 +616,7 @@ u32 TextureSource::generateTexture(const std::string &name)
/*
Calling only allowed from main thread
*/
- if (!thr_is_current_thread(m_main_thread)) {
+ if (std::this_thread::get_id() != m_main_thread) {
errorstream<<"TextureSource::generateTexture() "
"called not from main thread"<<std::endl;
return 0;
@@ -695,7 +695,7 @@ video::ITexture* TextureSource::getTextureForMesh(const std::string &name, u32 *
Palette* TextureSource::getPalette(const std::string &name)
{
// Only the main thread may load images
- sanity_check(thr_is_current_thread(m_main_thread));
+ sanity_check(std::this_thread::get_id() == m_main_thread);
if (name == "")
return NULL;
@@ -771,7 +771,7 @@ void TextureSource::insertSourceImage(const std::string &name, video::IImage *im
{
//infostream<<"TextureSource::insertSourceImage(): name="<<name<<std::endl;
- sanity_check(thr_is_current_thread(m_main_thread));
+ sanity_check(std::this_thread::get_id() == m_main_thread);
m_sourcecache.insert(name, img, true, m_device->getVideoDriver());
m_source_image_existence.set(name, true);
diff --git a/src/client/tile.h b/src/client/tile.h
index 15854fb71..23255c461 100644
--- a/src/client/tile.h
+++ b/src/client/tile.h
@@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irr_v3d.h"
#include <ITexture.h>
#include <IrrlichtDevice.h>
-#include "threads.h"
#include <string>
#include <vector>
#include "util/numeric.h"