diff options
author | ShadowNinja <shadowninja@minetest.net> | 2015-04-07 06:13:12 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2015-08-23 22:04:06 -0400 |
commit | e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd (patch) | |
tree | 7935586e79da5c8c7144e345a8c0fc1cda53beed /src/minimap.cpp | |
parent | 6a1047d8c116f793890b63427d53f04ceca95d54 (diff) | |
download | minetest-e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd.tar.gz minetest-e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd.tar.bz2 minetest-e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd.zip |
Clean up threading
* Rename everything.
* Strip J prefix.
* Change UpperCamelCase functions to lowerCamelCase.
* Remove global (!) semaphore count mutex on OSX.
* Remove semaphore count getter (unused, unsafe, depended on internal
API functions on Windows, and used a hack on OSX).
* Add `Atomic<type>`.
* Make `Thread` handle thread names.
* Add support for C++11 multi-threading.
* Combine pthread and win32 sources.
* Remove `ThreadStarted` (unused, unneeded).
* Move some includes from the headers to the sources.
* Move all of `Event` into its header (allows inlining with no new includes).
* Make `Event` use `Semaphore` (except on Windows).
* Move some porting functions into `Thread`.
* Integrate logging with `Thread`.
* Add threading test.
Diffstat (limited to 'src/minimap.cpp')
-rw-r--r-- | src/minimap.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/minimap.cpp b/src/minimap.cpp index d1fb3867d..7eb7247ca 100644 --- a/src/minimap.cpp +++ b/src/minimap.cpp @@ -20,8 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "minimap.h" #include <math.h> #include "logoutputbuffer.h" -#include "jthread/jmutexautolock.h" -#include "jthread/jsemaphore.h" +#include "threading/mutex_auto_lock.h" +#include "threading/semaphore.h" #include "clientmap.h" #include "settings.h" #include "nodedef.h" @@ -52,7 +52,7 @@ MinimapUpdateThread::~MinimapUpdateThread() bool MinimapUpdateThread::pushBlockUpdate(v3s16 pos, MinimapMapblock *data) { - JMutexAutoLock lock(m_queue_mutex); + MutexAutoLock lock(m_queue_mutex); // Find if block is already in queue. // If it is, update the data and quit. @@ -78,7 +78,7 @@ bool MinimapUpdateThread::pushBlockUpdate(v3s16 pos, MinimapMapblock *data) bool MinimapUpdateThread::popBlockUpdate(QueuedMinimapUpdate *update) { - JMutexAutoLock lock(m_queue_mutex); + MutexAutoLock lock(m_queue_mutex); if (m_update_queue.empty()) return false; @@ -256,13 +256,13 @@ Mapper::Mapper(IrrlichtDevice *device, Client *client) // Initialize and start thread m_minimap_update_thread = new MinimapUpdateThread(); m_minimap_update_thread->data = data; - m_minimap_update_thread->Start(); + m_minimap_update_thread->start(); } Mapper::~Mapper() { - m_minimap_update_thread->Stop(); - m_minimap_update_thread->Wait(); + m_minimap_update_thread->stop(); + m_minimap_update_thread->wait(); m_meshbuffer->drop(); @@ -290,7 +290,7 @@ MinimapMode Mapper::getMinimapMode() void Mapper::toggleMinimapShape() { - JMutexAutoLock lock(m_mutex); + MutexAutoLock lock(m_mutex); data->minimap_shape_round = !data->minimap_shape_round; g_settings->setBool("minimap_shape_round", data->minimap_shape_round); @@ -312,7 +312,7 @@ void Mapper::setMinimapMode(MinimapMode mode) if (mode >= MINIMAP_MODE_COUNT) return; - JMutexAutoLock lock(m_mutex); + MutexAutoLock lock(m_mutex); data->is_radar = modedefs[mode].is_radar; data->scan_height = modedefs[mode].scan_height; @@ -327,7 +327,7 @@ void Mapper::setPos(v3s16 pos) bool do_update = false; { - JMutexAutoLock lock(m_mutex); + MutexAutoLock lock(m_mutex); if (pos != data->old_pos) { data->old_pos = data->pos; |