aboutsummaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp37
1 files changed, 12 insertions, 25 deletions
diff --git a/src/client.cpp b/src/client.cpp
index ce48df953..b02e6229c 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -139,7 +139,7 @@ void MeshUpdateQueue::addBlock(v3s16 p, MeshMakeData *data, bool ack_block_to_se
// Returned pointer must be deleted
// Returns NULL if queue is empty
-QueuedMeshUpdate * MeshUpdateQueue::pop()
+QueuedMeshUpdate *MeshUpdateQueue::pop()
{
JMutexAutoLock lock(m_mutex);
@@ -162,26 +162,17 @@ QueuedMeshUpdate * MeshUpdateQueue::pop()
MeshUpdateThread
*/
-void * MeshUpdateThread::Thread()
+void MeshUpdateThread::enqueueUpdate(v3s16 p, MeshMakeData *data,
+ bool ack_block_to_server, bool urgent)
{
- ThreadStarted();
-
- log_register_thread("MeshUpdateThread");
-
- DSTACK(__FUNCTION_NAME);
-
- BEGIN_DEBUG_EXCEPTION_HANDLER
-
- porting::setThreadName("MeshUpdateThread");
+ m_queue_in.addBlock(p, data, ack_block_to_server, urgent);
+ deferUpdate();
+}
- while(!StopRequested())
- {
- QueuedMeshUpdate *q = m_queue_in.pop();
- if(q == NULL)
- {
- sleep_ms(3);
- continue;
- }
+void MeshUpdateThread::doUpdate()
+{
+ QueuedMeshUpdate *q;
+ while ((q = m_queue_in.pop())) {
ScopeProfiler sp(g_profiler, "Client: Mesh making");
@@ -196,10 +187,6 @@ void * MeshUpdateThread::Thread()
delete q;
}
-
- END_DEBUG_EXCEPTION_HANDLER(errorstream)
-
- return NULL;
}
/*
@@ -230,7 +217,7 @@ Client::Client(
m_nodedef(nodedef),
m_sound(sound),
m_event(event),
- m_mesh_update_thread(this),
+ m_mesh_update_thread(),
m_env(
new ClientMap(this, this, control,
device->getSceneManager()->getRootSceneNode(),
@@ -1600,7 +1587,7 @@ void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server, bool urgent)
}
// Add task to queue
- m_mesh_update_thread.m_queue_in.addBlock(p, data, ack_to_server, urgent);
+ m_mesh_update_thread.enqueueUpdate(p, data, ack_to_server, urgent);
}
void Client::addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server, bool urgent)