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.hpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'controller/JSONDB.hpp') diff --git a/controller/JSONDB.hpp b/controller/JSONDB.hpp index 55ead4ea..f89ff6c9 100644 --- a/controller/JSONDB.hpp +++ b/controller/JSONDB.hpp @@ -82,19 +82,12 @@ public: inline bool getNetworkSummaryInfo(const uint64_t networkId,NetworkSummaryInfo &ns) const { - for(;;) { - { - Mutex::Lock _l(_networks_m); - std::unordered_map::const_iterator i(_networks.find(networkId)); - if (i == _networks.end()) - return false; - if (i->second.summaryInfoLastComputed) { - ns = i->second.summaryInfo; - return true; - } - } - Thread::sleep(100); // wait for this to be done the first time, which happens when we start - } + Mutex::Lock _l(_networks_m); + std::unordered_map::const_iterator i(_networks.find(networkId)); + if (i == _networks.end()) + return false; + ns = i->second.summaryInfo; + return true; } /** -- cgit v1.2.3