Deadlock fix.

This commit is contained in:
Adam Ierymenko 2017-04-26 12:17:43 -07:00
parent 7c184cf991
commit e8ab6adf89
2 changed files with 16 additions and 14 deletions

View file

@ -82,19 +82,12 @@ public:
inline bool getNetworkSummaryInfo(const uint64_t networkId,NetworkSummaryInfo &ns) const
{
for(;;) {
{
Mutex::Lock _l(_networks_m);
std::unordered_map<uint64_t,_NW>::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<uint64_t,_NW>::const_iterator i(_networks.find(networkId));
if (i == _networks.end())
return false;
ns = i->second.summaryInfo;
return true;
}
/**