mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-07 18:15:51 +08:00
refactor: Add asserts to check executing in worker thread
This commit is contained in:
@@ -45,6 +45,7 @@ namespace swift::core::db
|
||||
void CDatabaseReader::readInBackgroundThread(CEntityFlags::Entity entities, const QDateTime &newerThan)
|
||||
{
|
||||
if (!this->doWorkCheck()) { return; }
|
||||
Q_ASSERT_X(hasStarted(), Q_FUNC_INFO, "Thread was not started yet!");
|
||||
|
||||
// we accept cached data
|
||||
Q_ASSERT_X(!entities.testFlag(CEntityFlags::DbInfoObjectEntity), Q_FUNC_INFO, "Read info objects directly");
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace swift::core
|
||||
|
||||
void CThreadedReaderPeriodic::startReader()
|
||||
{
|
||||
Q_ASSERT_X(hasStarted(), Q_FUNC_INFO, "Thread was not started yet!");
|
||||
Q_ASSERT(m_initialTime > 0);
|
||||
QTimer::singleShot(m_initialTime, this, [=] { this->doWork(); });
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace swift::core::vatsim
|
||||
|
||||
void CVatsimServerFileReader::readInBackgroundThread()
|
||||
{
|
||||
Q_ASSERT_X(hasStarted(), Q_FUNC_INFO, "Thread was not started yet!");
|
||||
QPointer<CVatsimServerFileReader> myself(this);
|
||||
QTimer::singleShot(0, this, [=] {
|
||||
if (!myself) { return; }
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace swift::core::vatsim
|
||||
|
||||
void CVatsimStatusFileReader::readInBackgroundThread()
|
||||
{
|
||||
Q_ASSERT_X(hasStarted(), Q_FUNC_INFO, "Thread was not started yet!");
|
||||
QPointer<CVatsimStatusFileReader> myself(this);
|
||||
QTimer::singleShot(0, this, [=] {
|
||||
if (!myself) { return; }
|
||||
|
||||
Reference in New Issue
Block a user