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/statusmessage.h"
#include "blackmisc/datacache.h"
#include "blackmisc/threadutils.h"
#include "blackmisc/blackmiscexport.h"
#include <QDateTime>
@@ -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;
}