X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Futil%2Fthread.h;h=73e9beb806f44d8effc6dd8e3a3bec3f82adf23f;hb=c7bcebb62856ae5fdb23a13e6fa1052eae700ddf;hp=f54b8b48f25dfcbfa91002364d17d70bd77d00bb;hpb=f98bbe193e0093aca8d8957cec82fdbd28639915;p=minetest.git diff --git a/src/util/thread.h b/src/util/thread.h index f54b8b48f..73e9beb80 100644 --- a/src/util/thread.h +++ b/src/util/thread.h @@ -17,13 +17,11 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef UTIL_THREAD_HEADER -#define UTIL_THREAD_HEADER +#pragma once -#include "../irrlichttypes.h" -#include "../threading/thread.h" -#include "../threading/mutex.h" -#include "../threading/mutex_auto_lock.h" +#include "irrlichttypes.h" +#include "threading/thread.h" +#include "threading/mutex_auto_lock.h" #include "porting.h" #include "log.h" #include "container.h" @@ -51,7 +49,7 @@ class MutexedVariable // You pretty surely want to grab the lock when accessing this T m_value; private: - Mutex m_mutex; + std::mutex m_mutex; }; /* @@ -80,11 +78,11 @@ class CallerInfo { template class GetRequest { public: - GetRequest() {} - ~GetRequest() {} + GetRequest() = default; + ~GetRequest() = default; - GetRequest(Key a_key) { - key = a_key; + GetRequest(const Key &a_key): key(a_key) + { } Key key; @@ -106,7 +104,7 @@ class RequestQueue { return m_queue.empty(); } - void add(Key key, Caller caller, CallerData callerdata, + void add(const Key &key, Caller caller, CallerData callerdata, ResultQueue *dest) { typename std::deque >::iterator i; @@ -191,7 +189,7 @@ class UpdateThread : public Thread { public: UpdateThread(const std::string &name) : Thread(name + "Update") {} - ~UpdateThread() {} + ~UpdateThread() = default; void deferUpdate() { m_update_sem.post(); } @@ -205,7 +203,6 @@ class UpdateThread : public Thread void *run() { - DSTACK(FUNCTION_NAME); BEGIN_DEBUG_EXCEPTION_HANDLER while (!stopRequested()) { @@ -229,6 +226,3 @@ class UpdateThread : public Thread private: Semaphore m_update_sem; }; - -#endif -