[Server] FIx deadlock

This commit is contained in:
Koncord 2017-05-07 01:50:43 +08:00
parent c2ce2f2ce7
commit a0b71eda23

View file

@ -94,11 +94,12 @@ void MasterClient::SetRuleValue(std::string key, double value)
mutexData.lock(); mutexData.lock();
if (queryData.rules.find(key) == queryData.rules.end() || queryData.rules[key].type != 'v' if (queryData.rules.find(key) == queryData.rules.end() || queryData.rules[key].type != 'v'
|| queryData.rules[key].val != value) || queryData.rules[key].val != value)
return; {
ServerRule rule; ServerRule rule;
rule.str = value; rule.val = value;
rule.type = 'v'; rule.type = 'v';
queryData.rules.insert({key, rule}); queryData.rules.insert({key, rule});
}
mutexData.unlock(); mutexData.unlock();
} }