Closed calvinxiao closed 3 years ago
Good question, there's not a possible deadlock since we lock and unlock one key every loop. if we lock all keys outside at once outside the loop that may cause deadlock without sorting.
Right, it will get unlocked after each loop.
The following code loop over
vector<StringPair>
and perform locking on each item.If the keys are not sorted, is there going to be a potential dead lock problem?