Ref T285, Ref T292 central caches only work in same thread

This commit is contained in:
Klaus Basan
2018-07-27 23:27:10 +02:00
parent 19f5fd1735
commit a8a36591f8

View File

@@ -18,6 +18,7 @@
#include "blackmisc/applicationinfo.h" #include "blackmisc/applicationinfo.h"
#include "blackmisc/statusmessage.h" #include "blackmisc/statusmessage.h"
#include "blackmisc/datacache.h" #include "blackmisc/datacache.h"
#include "blackmisc/threadutils.h"
#include "blackmisc/blackmiscexport.h" #include "blackmisc/blackmiscexport.h"
#include <QDateTime> #include <QDateTime>
@@ -415,9 +416,11 @@ namespace BlackMisc
public: public:
//! Central instance //! Central instance
//! \remark can only be used in the thread created
static CCentralMultiSimulatorModelCachesProvider &modelCachesInstance() static CCentralMultiSimulatorModelCachesProvider &modelCachesInstance()
{ {
static CCentralMultiSimulatorModelCachesProvider c("Central model caches provider"); static CCentralMultiSimulatorModelCachesProvider c("Central model caches provider");
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(&c), Q_FUNC_INFO, "Wrong thread");
return c; return c;
} }
@@ -466,9 +469,11 @@ namespace BlackMisc
public: public:
//! Central instance //! Central instance
//! \remark can only be used in the thread created
static CCentralMultiSimulatorModelSetCachesProvider &modelCachesInstance() static CCentralMultiSimulatorModelSetCachesProvider &modelCachesInstance()
{ {
static CCentralMultiSimulatorModelSetCachesProvider c("Central model sets provider"); static CCentralMultiSimulatorModelSetCachesProvider c("Central model sets provider");
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(&c), Q_FUNC_INFO, "Wrong thread");
return c; return c;
} }