aboutsummaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2015-04-07 06:13:12 -0400
committerShadowNinja <shadowninja@minetest.net>2015-08-23 22:04:06 -0400
commite4bff8be94c0db4f94e63ad448d0eeb869ccdbbd (patch)
tree7935586e79da5c8c7144e345a8c0fc1cda53beed /src/client.cpp
parent6a1047d8c116f793890b63427d53f04ceca95d54 (diff)
downloadhax-minetest-server-e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd.tar.gz
hax-minetest-server-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/client.cpp')
-rw-r--r--src/client.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 946f4f1c4..2a253fd75 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <algorithm>
#include <sstream>
#include <IFileSystem.h>
-#include "jthread/jmutexautolock.h"
+#include "threading/mutex_auto_lock.h"
#include "util/auth.h"
#include "util/directiontables.h"
#include "util/pointedthing.h"
@@ -82,7 +82,7 @@ MeshUpdateQueue::MeshUpdateQueue()
MeshUpdateQueue::~MeshUpdateQueue()
{
- JMutexAutoLock lock(m_mutex);
+ MutexAutoLock lock(m_mutex);
for(std::vector<QueuedMeshUpdate*>::iterator
i = m_queue.begin();
@@ -102,7 +102,7 @@ void MeshUpdateQueue::addBlock(v3s16 p, MeshMakeData *data, bool ack_block_to_se
assert(data); // pre-condition
- JMutexAutoLock lock(m_mutex);
+ MutexAutoLock lock(m_mutex);
if(urgent)
m_urgents.insert(p);
@@ -141,7 +141,7 @@ void MeshUpdateQueue::addBlock(v3s16 p, MeshMakeData *data, bool ack_block_to_se
// Returns NULL if queue is empty
QueuedMeshUpdate *MeshUpdateQueue::pop()
{
- JMutexAutoLock lock(m_mutex);
+ MutexAutoLock lock(m_mutex);
bool must_be_urgent = !m_urgents.empty();
for(std::vector<QueuedMeshUpdate*>::iterator
@@ -269,7 +269,7 @@ Client::Client(
void Client::Stop()
{
//request all client managed threads to stop
- m_mesh_update_thread.Stop();
+ m_mesh_update_thread.stop();
// Save local server map
if (m_localdb) {
infostream << "Local map saving ended." << std::endl;
@@ -280,7 +280,7 @@ void Client::Stop()
bool Client::isShutdown()
{
- if (!m_mesh_update_thread.IsRunning()) return true;
+ if (!m_mesh_update_thread.isRunning()) return true;
return false;
}
@@ -289,8 +289,8 @@ Client::~Client()
{
m_con.Disconnect();
- m_mesh_update_thread.Stop();
- m_mesh_update_thread.Wait();
+ m_mesh_update_thread.stop();
+ m_mesh_update_thread.wait();
while (!m_mesh_update_thread.m_queue_out.empty()) {
MeshUpdateResult r = m_mesh_update_thread.m_queue_out.pop_frontNoEx();
delete r.mesh;
@@ -1270,7 +1270,7 @@ void Client::sendPlayerPos()
u16 our_peer_id;
{
- //JMutexAutoLock lock(m_con_mutex); //bulk comment-out
+ //MutexAutoLock lock(m_con_mutex); //bulk comment-out
our_peer_id = m_con.GetPeerID();
}
@@ -1794,7 +1794,7 @@ void Client::afterContentReceived(IrrlichtDevice *device)
// Start mesh update thread after setting up content definitions
infostream<<"- Starting mesh update thread"<<std::endl;
- m_mesh_update_thread.Start();
+ m_mesh_update_thread.start();
m_state = LC_Ready;
sendReady();