From a8a36591f8638f137784915afcb516fb00b93c6c Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 27 Jul 2018 23:27:10 +0200 Subject: [PATCH] Ref T285, Ref T292 central caches only work in same thread --- src/blackmisc/simulation/data/modelcaches.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/blackmisc/simulation/data/modelcaches.h b/src/blackmisc/simulation/data/modelcaches.h index 95a7589d4..61195e1b3 100644 --- a/src/blackmisc/simulation/data/modelcaches.h +++ b/src/blackmisc/simulation/data/modelcaches.h @@ -18,6 +18,7 @@ #include "blackmisc/applicationinfo.h" #include "blackmisc/statusmessage.h" #include "blackmisc/datacache.h" +#include "blackmisc/threadutils.h" #include "blackmisc/blackmiscexport.h" #include @@ -415,9 +416,11 @@ namespace BlackMisc public: //! Central instance + //! \remark can only be used in the thread created static CCentralMultiSimulatorModelCachesProvider &modelCachesInstance() { static CCentralMultiSimulatorModelCachesProvider c("Central model caches provider"); + Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(&c), Q_FUNC_INFO, "Wrong thread"); return c; } @@ -466,9 +469,11 @@ namespace BlackMisc public: //! Central instance + //! \remark can only be used in the thread created static CCentralMultiSimulatorModelSetCachesProvider &modelCachesInstance() { static CCentralMultiSimulatorModelSetCachesProvider c("Central model sets provider"); + Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(&c), Q_FUNC_INFO, "Wrong thread"); return c; }