mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +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)
|
void CDatabaseReader::readInBackgroundThread(CEntityFlags::Entity entities, const QDateTime &newerThan)
|
||||||
{
|
{
|
||||||
if (!this->doWorkCheck()) { return; }
|
if (!this->doWorkCheck()) { return; }
|
||||||
|
Q_ASSERT_X(hasStarted(), Q_FUNC_INFO, "Thread was not started yet!");
|
||||||
|
|
||||||
// we accept cached data
|
// we accept cached data
|
||||||
Q_ASSERT_X(!entities.testFlag(CEntityFlags::DbInfoObjectEntity), Q_FUNC_INFO, "Read info objects directly");
|
Q_ASSERT_X(!entities.testFlag(CEntityFlags::DbInfoObjectEntity), Q_FUNC_INFO, "Read info objects directly");
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace swift::core
|
|||||||
|
|
||||||
void CThreadedReaderPeriodic::startReader()
|
void CThreadedReaderPeriodic::startReader()
|
||||||
{
|
{
|
||||||
|
Q_ASSERT_X(hasStarted(), Q_FUNC_INFO, "Thread was not started yet!");
|
||||||
Q_ASSERT(m_initialTime > 0);
|
Q_ASSERT(m_initialTime > 0);
|
||||||
QTimer::singleShot(m_initialTime, this, [=] { this->doWork(); });
|
QTimer::singleShot(m_initialTime, this, [=] { this->doWork(); });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace swift::core::vatsim
|
|||||||
|
|
||||||
void CVatsimServerFileReader::readInBackgroundThread()
|
void CVatsimServerFileReader::readInBackgroundThread()
|
||||||
{
|
{
|
||||||
|
Q_ASSERT_X(hasStarted(), Q_FUNC_INFO, "Thread was not started yet!");
|
||||||
QPointer<CVatsimServerFileReader> myself(this);
|
QPointer<CVatsimServerFileReader> myself(this);
|
||||||
QTimer::singleShot(0, this, [=] {
|
QTimer::singleShot(0, this, [=] {
|
||||||
if (!myself) { return; }
|
if (!myself) { return; }
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace swift::core::vatsim
|
|||||||
|
|
||||||
void CVatsimStatusFileReader::readInBackgroundThread()
|
void CVatsimStatusFileReader::readInBackgroundThread()
|
||||||
{
|
{
|
||||||
|
Q_ASSERT_X(hasStarted(), Q_FUNC_INFO, "Thread was not started yet!");
|
||||||
QPointer<CVatsimStatusFileReader> myself(this);
|
QPointer<CVatsimStatusFileReader> myself(this);
|
||||||
QTimer::singleShot(0, this, [=] {
|
QTimer::singleShot(0, this, [=] {
|
||||||
if (!myself) { return; }
|
if (!myself) { return; }
|
||||||
|
|||||||
Reference in New Issue
Block a user