Issue #77 Rename

This commit is contained in:
Mat Sutcliffe
2020-08-24 17:48:55 +01:00
parent 936e869c94
commit 802576eda9
30 changed files with 95 additions and 91 deletions

View File

@@ -738,7 +738,7 @@ namespace BlackCore
bool CAfvClient::setInputVolumeDb(double valueDb)
{
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
// call in background thread of AFVClient to avoid lock issues
QPointer<CAfvClient> myself(this);
@@ -986,7 +986,7 @@ namespace BlackCore
this->stopAudio();
this->disconnectFrom();
this->quitAndWait();
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Needs to be back in current thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Needs to be back in current thread");
}
void CAfvClient::initialize()
@@ -1398,7 +1398,7 @@ namespace BlackCore
bool CAfvClient::setOutputVolumeDb(double valueDb)
{
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
// call in background thread of AFVClient to avoid lock issues
QPointer<CAfvClient> myself(this);

View File

@@ -219,7 +219,7 @@ namespace BlackCore
void CAirspaceAnalyzer::analyzeAirspace()
{
Q_ASSERT_X(!CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background thread");
Q_ASSERT_X(!CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "Expect to run in background thread");
Q_ASSERT_X(thread() != qApp->thread(), Q_FUNC_INFO, "Expect to run in background thread affinity");
bool restricted, enabled;

View File

@@ -562,7 +562,7 @@ namespace BlackCore
void CAirspaceMonitor::onReceivedAtcBookings(const CAtcStationList &bookedStations)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT(CThreadUtils::isInThisThread(this));
if (bookedStations.isEmpty())
{
m_atcStationsBooked.clear();
@@ -592,7 +592,7 @@ namespace BlackCore
void CAirspaceMonitor::onReceivedVatsimDataFile()
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT(CThreadUtils::isInThisThread(this));
if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return; }
CClientList clients(this->getClients()); // copy
bool changed = false;
@@ -731,7 +731,7 @@ namespace BlackCore
void CAirspaceMonitor::onAtcPositionUpdate(const CCallsign &callsign, const CFrequency &frequency, const CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range)
{
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "wrong thread");
if (!this->isConnectedAndNotShuttingDown()) { return; }
const CAtcStationList stationsWithCallsign = m_atcStationsOnline.findByCallsign(callsign);
@@ -780,7 +780,7 @@ namespace BlackCore
void CAirspaceMonitor::onAtcControllerDisconnected(const CCallsign &callsign)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT(CThreadUtils::isInThisThread(this));
if (!this->isConnectedAndNotShuttingDown()) { return; }
this->removeClient(callsign);
@@ -798,7 +798,7 @@ namespace BlackCore
void CAirspaceMonitor::onAtisReceived(const CCallsign &callsign, const CInformationMessage &atisMessage)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT(CThreadUtils::isInThisThread(this));
if (!this->isConnectedAndNotShuttingDown() || callsign.isEmpty()) return;
const bool changedAtis = m_atcStationsOnline.updateIfMessageChanged(atisMessage, callsign, true);
@@ -811,7 +811,7 @@ namespace BlackCore
void CAirspaceMonitor::onAtisLogoffTimeReceived(const CCallsign &callsign, const QString &zuluTime)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT(CThreadUtils::isInThisThread(this));
if (!this->isConnectedAndNotShuttingDown()) { return; }
if (zuluTime.length() == 4)
@@ -837,7 +837,7 @@ namespace BlackCore
// ES sends FsInn packets for callsigns such as ACCGER1, which are hard to distinguish
// 1) checking if they are already in the list checks again ATC position which is safe
// 2) the ATC alike callsign check is guessing
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "not in main thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "not in main thread");
if (!callsign.isValid()) { return; } // aircraft OBS, other invalid callsigns
if (!this->isConnectedAndNotShuttingDown()) { return; }
@@ -899,7 +899,7 @@ namespace BlackCore
void CAirspaceMonitor::onIcaoCodesReceived(const CCallsign &callsign, const QString &aircraftIcaoDesignator, const QString &airlineIcaoDesignator, const QString &livery)
{
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "not in main thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "not in main thread");
if (!this->isConnectedAndNotShuttingDown()) { return; }
if (CBuildConfig::isLocalDeveloperDebugBuild()) { BLACK_VERIFY_X(callsign.isValid(), Q_FUNC_INFO, "invalid callsign"); }
if (!callsign.isValid()) { return; }
@@ -1217,7 +1217,7 @@ namespace BlackCore
void CAirspaceMonitor::onAircraftUpdateReceived(const CAircraftSituation &situation, const CTransponder &transponder)
{
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Called in different thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Called in different thread");
if (!this->isConnectedAndNotShuttingDown()) { return; }
const CCallsign callsign(situation.getCallsign());
@@ -1267,7 +1267,7 @@ namespace BlackCore
void CAirspaceMonitor::onAircraftInterimUpdateReceived(const CAircraftSituation &situation)
{
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Called in different thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Called in different thread");
if (!this->isConnectedAndNotShuttingDown()) { return; }
const CCallsign callsign(situation.getCallsign());
@@ -1329,7 +1329,7 @@ namespace BlackCore
void CAirspaceMonitor::onPilotDisconnected(const CCallsign &callsign)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT(CThreadUtils::isInThisThread(this));
// in case of inconsistencies I always remove here
this->removeFromAircraftCachesAndLogs(callsign);
@@ -1340,7 +1340,7 @@ namespace BlackCore
void CAirspaceMonitor::onFrequencyReceived(const CCallsign &callsign, const CFrequency &frequency)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT(CThreadUtils::isInThisThread(this));
// update
const CPropertyIndexVariantMap vm({CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency}, CVariant::from(frequency));
@@ -1350,7 +1350,7 @@ namespace BlackCore
void CAirspaceMonitor::onRevBAircraftConfigReceived(const CCallsign &callsign, const QString &config, qint64 currentOffsetMs)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT(CThreadUtils::isInThisThread(this));
BLACK_AUDIT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
if (callsign.isEmpty()) { return; }
@@ -1410,7 +1410,7 @@ namespace BlackCore
void CAirspaceMonitor::onAircraftConfigReceived(const CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT(CThreadUtils::isInThisThread(this));
BLACK_AUDIT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
if (callsign.isEmpty()) { return; }

View File

@@ -1769,7 +1769,7 @@ namespace BlackCore
{
// should be now in QAM thread
if (!sApp || sApp->isShuttingDown()) { return; }
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(sApp->m_accessManager), Q_FUNC_INFO, "Wrong thread, must be QAM thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(sApp->m_accessManager), Q_FUNC_INFO, "Wrong thread, must be QAM thread");
this->httpRequestImpl(request, logId, callback, progress, maxRedirects, getPostOrDeleteRequest);
});
}
@@ -1782,7 +1782,7 @@ namespace BlackCore
{
// should be now in QAM thread
if (!sApp || sApp->isShuttingDown()) { return; }
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(sApp->m_accessManager), Q_FUNC_INFO, "Wrong thread, must be QAM thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(sApp->m_accessManager), Q_FUNC_INFO, "Wrong thread, must be QAM thread");
const QNetworkAccessManager::NetworkAccessibility accessibility = m_accessManager->networkAccessible();
m_networkWatchDog->setNetworkAccessibility(accessibility);
});
@@ -1805,13 +1805,13 @@ namespace BlackCore
QWriteLocker locker(&m_accessManagerLock);
Q_ASSERT_X(m_accessManager->thread() == qApp->thread(), Q_FUNC_INFO, "Network manager supposed to be in main thread");
if (!CThreadUtils::isCurrentThreadObjectThread(m_accessManager))
if (!CThreadUtils::isInThisThread(m_accessManager))
{
this->httpRequestImplInQAMThread(request, logId, callback, progress, maxRedirects, getPostOrDeleteRequest);
return nullptr; // not yet started, will be called again in QAM thread
}
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_accessManager), Q_FUNC_INFO, "Network manager thread mismatch");
Q_ASSERT_X(CThreadUtils::isInThisThread(m_accessManager), Q_FUNC_INFO, "Network manager thread mismatch");
QNetworkRequest copiedRequest = CNetworkUtils::getSwiftNetworkRequest(request, this->getApplicationNameAndVersion());
// If URL is one of the shared URLs, add swift client SSL certificate to request

View File

@@ -217,7 +217,7 @@ namespace BlackCore
if (m_voiceClient)
{
m_voiceClient->gracefulShutdown();
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_voiceClient), Q_FUNC_INFO, "Needs to be back in current thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(m_voiceClient), Q_FUNC_INFO, "Needs to be back in current thread");
m_voiceClient->deleteLater();
m_voiceClient = nullptr;
#ifdef Q_OS_WIN

View File

@@ -461,7 +461,7 @@ namespace BlackCore
Q_ASSERT(this->getIContextApplication());
Q_ASSERT(this->getIContextApplication()->isUsingImplementingObject());
Q_ASSERT(!simulatorPluginInfo.isUnspecified());
Q_ASSERT(CThreadUtils::isCurrentThreadApplicationThread()); // only run in main thread
Q_ASSERT(CThreadUtils::thisIsMainThread()); // only run in main thread
// Is a plugin already loaded?
if (!m_simulatorPlugin.first.isUnspecified())

View File

@@ -619,7 +619,7 @@ namespace BlackCore
const bool overrideNewerOnly = true;
entities = this->maskBySupportedEntities(entities);
if (inBackground || !CThreadUtils::isCurrentThreadObjectThread(this))
if (inBackground || !CThreadUtils::isInThisThread(this))
{
const bool s = this->readFromJsonFilesInBackground(CDirectoryUtils::staticDbFilesDirectory(), entities, overrideNewerOnly);
return s ?

View File

@@ -234,7 +234,7 @@ namespace BlackCore
if (m_disableNetworkCheck) { return; } // ignore with disabled check
// shift to thread
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
QPointer<CNetworkWatchdog> myself(this);
QTimer::singleShot(0, this, [ = ]
@@ -315,7 +315,7 @@ namespace BlackCore
nw->close();
if (!sApp || sApp->isShuttingDown()) { return; }
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Wrong thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Wrong thread");
m_lastClientPingSuccess = ok;
{

View File

@@ -225,7 +225,7 @@ namespace BlackCore
void CFSDClient::connectToServer()
{
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
QMetaObject::invokeMethod(this, [ = ]
{
@@ -265,7 +265,7 @@ namespace BlackCore
void CFSDClient::disconnectFromServer()
{
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
QMetaObject::invokeMethod(this, [ = ]
{
@@ -441,7 +441,7 @@ namespace BlackCore
void CFSDClient::sendClientQuery(ClientQueryType queryType, const CCallsign &receiver, const QStringList &queryData)
{
if (queryType == ClientQueryType::Unknown) { return; }
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
QMetaObject::invokeMethod(this, [ = ]
{
@@ -514,7 +514,7 @@ namespace BlackCore
void CFSDClient::sendTextMessages(const CTextMessageList &messages)
{
if (messages.isEmpty()) { return; }
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
QMetaObject::invokeMethod(this, [ = ]
{
@@ -565,7 +565,7 @@ namespace BlackCore
void CFSDClient::sendTextMessage(TextMessageGroups receiverGroup, const QString &message)
{
if (message.isEmpty()) { return; }
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
QMetaObject::invokeMethod(this, [ = ]
{
@@ -614,7 +614,7 @@ namespace BlackCore
void CFSDClient::sendFlightPlan(const CFlightPlan &flightPlan)
{
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
QMetaObject::invokeMethod(this, [ = ]
{
@@ -671,7 +671,7 @@ namespace BlackCore
void CFSDClient::sendPlaneInfoRequest(const CCallsign &receiver)
{
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
QMetaObject::invokeMethod(this, [ = ]
{
@@ -687,7 +687,7 @@ namespace BlackCore
void CFSDClient::sendPlaneInfoRequestFsinn(const CCallsign &callsign)
{
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
QMetaObject::invokeMethod(this, [ = ]
{

View File

@@ -343,7 +343,7 @@ namespace BlackCore
void ISimulator::safeKillTimer()
{
if (m_timerId < 0) { return; }
BLACK_AUDIT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
BLACK_AUDIT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
this->killTimer(m_timerId);
m_timerId = -1;
}
@@ -816,7 +816,7 @@ namespace BlackCore
// when changing back from restricted->unrestricted an one time update is required
if (!snapshot.isRestricted() && !snapshot.isRestrictionChanged()) { return; }
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Needs to run in object thread");
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Needs to run in object thread");
Q_ASSERT_X(snapshot.generatingThreadName() != QThread::currentThread()->objectName(), Q_FUNC_INFO, "Expect snapshot from background thread");
// restricted snapshot values?
@@ -1464,7 +1464,7 @@ namespace BlackCore
void ISimulatorListener::start()
{
if (m_isRunning) { return; }
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
// call in correct thread
QPointer<ISimulatorListener> myself(this);
@@ -1479,7 +1479,7 @@ namespace BlackCore
void ISimulatorListener::stop()
{
if (!m_isRunning) { return; }
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
// call in correct thread
QPointer<ISimulatorListener> myself(this);
@@ -1494,7 +1494,7 @@ namespace BlackCore
void ISimulatorListener::check()
{
if (!m_isRunning) { return; }
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
// call in correct thread
QPointer<ISimulatorListener> myself(this);

View File

@@ -167,7 +167,7 @@ namespace BlackCore
if (!this->isEnabled()) { return false; }
// MS 2019-02-23 isAbandoned() check only makes sense when called by worker thread (T541)
if (CThreadUtils::isCurrentThreadObjectThread(this) && this->isAbandoned()) { return false; }
if (CThreadUtils::isInThisThread(this) && this->isAbandoned()) { return false; }
if (!m_unitTest && (!sApp || sApp->isShuttingDown())) { return false; }
return true;

View File

@@ -1012,7 +1012,7 @@ namespace BlackCore
void CWebDataServices::initReaders(CWebReaderFlags::WebReader readersNeeded, CEntityFlags::Entity entities)
{
Q_ASSERT_X(CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "shall run in main application thread");
Q_ASSERT_X(CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "shall run in main application thread");
//
// ---- "metadata" reader, 1 will trigger read directly during init
@@ -1173,7 +1173,7 @@ namespace BlackCore
{
// run in correct thread
if (m_shuttingDown) { return; }
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
const QPointer<CWebDataServices> myself(this);
QTimer::singleShot(0, this, [ = ]
@@ -1215,7 +1215,7 @@ namespace BlackCore
{
// run in correct thread
if (m_shuttingDown) { return; }
if (!CThreadUtils::isCurrentThreadObjectThread(this))
if (!CThreadUtils::isInThisThread(this))
{
const QPointer<CWebDataServices> myself(this);
QTimer::singleShot(0, this, [ = ]
@@ -1582,7 +1582,7 @@ namespace BlackCore
if (m_icaoDataReader)
{
// force update to background reading if reader is already in another thread
bool ib = inBackground || !CThreadUtils::isCurrentThreadObjectThread(m_icaoDataReader);
bool ib = inBackground || !CThreadUtils::isInThisThread(m_icaoDataReader);
if (ib)
{
CLogMessage(this).info(u"Reading from disk in background: %1") << m_icaoDataReader->getSupportedEntitiesAsString();
@@ -1600,7 +1600,7 @@ namespace BlackCore
if (m_modelDataReader)
{
// force update to background reading if reader is already in another thread
bool ib = inBackground || !CThreadUtils::isCurrentThreadObjectThread(m_modelDataReader);
bool ib = inBackground || !CThreadUtils::isInThisThread(m_modelDataReader);
if (ib)
{
CLogMessage(this).info(u"Reading from disk in background: %1") << m_modelDataReader->getSupportedEntitiesAsString();
@@ -1618,7 +1618,7 @@ namespace BlackCore
if (m_airportDataReader)
{
// force update to background reading if reader is already in another thread
bool ib = inBackground || !CThreadUtils::isCurrentThreadObjectThread(m_airportDataReader);
bool ib = inBackground || !CThreadUtils::isInThisThread(m_airportDataReader);
if (ib)
{
CLogMessage(this).info(u"Reading from disk in background: %1") << m_airportDataReader->getSupportedEntitiesAsString();