Commit e5de7708 authored by Volker Krause's avatar Volker Krause Committed by Torsten Rahn
Browse files

Add a simple reentrancy guard

Due to the use of sub-processes during the tile generation we re-enter the
event loop, and thus might receive another socket notification while the
previous one is still being processed.
parent ce155a1a
......@@ -7,6 +7,7 @@
#include "tirexbackend.h"
#include <QDir>
#include <QScopedValueRollback>
#include <QSettings>
#include <QSocketNotifier>
......@@ -50,6 +51,11 @@ TirexBackend::~TirexBackend() = default;
void TirexBackend::commandReadyRead()
{
if (m_recursionLock) {
return;
}
QScopedValueRollback<bool> lock(m_recursionLock, true);
while (true) {
m_renderTime.restart();
TirexMetatileRequest req;
......
......@@ -86,6 +86,7 @@ private:
QString m_tileDir;
QElapsedTimer m_renderTime;
int m_heartbeatFd = -1;
bool m_recursionLock = false;
static constexpr const int m_metatileRows = 8; // TODO read from config eventually
static constexpr const int m_metatileCols = 8;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment