From e8ab6adf8902dce98b4721e2f4a5382e54bcbcbc Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 26 Apr 2017 12:17:43 -0700 Subject: Deadlock fix. --- controller/JSONDB.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'controller/JSONDB.cpp') diff --git a/controller/JSONDB.cpp b/controller/JSONDB.cpp index 9b0dd836..a2fe7f2a 100644 --- a/controller/JSONDB.cpp +++ b/controller/JSONDB.cpp @@ -60,6 +60,15 @@ JSONDB::JSONDB(const std::string &basePath) : for(std::unordered_map::iterator n(_networks.begin());n!=_networks.end();++n) _recomputeSummaryInfo(n->first); + for(;;) { + _summaryThread_m.lock(); + if (_summaryThreadToDo.empty()) { + _summaryThread_m.unlock(); + break; + } + _summaryThread_m.unlock(); + Thread::sleep(50); + } } JSONDB::~JSONDB() @@ -107,7 +116,7 @@ void JSONDB::saveNetwork(const uint64_t networkId,const nlohmann::json &networkC Mutex::Lock _l(_networks_m); _networks[networkId].config = networkConfig; } - //_recomputeSummaryInfo(networkId); + _recomputeSummaryInfo(networkId); } void JSONDB::saveNetworkMember(const uint64_t networkId,const uint64_t nodeId,const nlohmann::json &memberConfig) -- cgit v1.2.3