message: only check lock ordering when we are not locking recursively
diff: @@ -139,7 +139,7 @@ void potential_deadlock_detected(LockStackEntry now, LockStack &deadlocks, std::
  void potential_lock_order_issue_detected(std::string thisLock, std::string otherLock)
  {
  LOGA("POTENTIAL LOCK ORDER ISSUE DETECTED\n");
  - LOGA("This occurred while trying to lock: %s after %s", thisLock.c_str(), otherLock.c_str());
  + LOGA("This occurred while trying to lock: %s after %s \n", thisLock.c_str(), otherLock.c_str());
  LOGA("We have previously locked this locks in the reverse order\n");
  throw std::logic_error("potential lock order issue detected");
  }
  @@ -493,7 +493,31 @@ void push_lock(void *c, const CLockLocation &locklocation, LockType locktype, Ow
  DbgAssert(!"unsupported lock type", return );
  }
  - // check for lock ordering issues
  + // Begin general deadlock checks for all lock types
  + bool lockingRecursively = false;
  + // if lock not shared mutex, check if we are doing a recursive lock
  + if (locktype != LockType::SHARED_MUTEX)
  + {
  + auto it = lockdata.locksheldbythread.find(tid);
  + if (it != lockdata.locksheldbythread.end())
  + {
  + // check if we have locked this lock before
  + for (auto &entry : it->second)
  + {
  + // if we have locked this lock before...
  + if (entry.first == c)
  + {
  + // then we are locking recursively
  + lockingRecursively = true;
  + break;
  + }
  + }
  + }
  + }
  +
  + // check for lock ordering issues, skip if locking recursively because we already have an order
  + if (lockingRecursively == false)
  + {
  // caluclate this locks name
  std::string lockname = locklocation.GetMutexName();
  // get a list of locks we have locked using this threads id
  @@ -536,29 +560,8 @@ void push_lock(void *c, const CLockLocation &locklocation, LockType locktype, Ow
  lockdata.seenlockorders.emplace(lockname, std::set<std::string>());
  }
  }
  -
  -
  - // Begin general deadlock checks for all lock types
  - bool lockingRecursively = false;
  - // if lock not shared mutex, check if we are doing a recursive lock
  - if (locktype != LockType::SHARED_MUTEX)
  - {
  - auto it = lockdata.locksheldbythread.find(tid);
  - if (it != lockdata.locksheldbythread.end())
  - {
  - // check if we have locked this lock before
  - for (auto &entry : it->second)
  - {
  - // if we have locked this lock before...
  - if (entry.first == c)
  - {
  - // then we are locking recursively
  - lockingRecursively = true;
  - break;
  - }
  - }
  - }
  }
  +
  AddNewLock(now, tid);
  if (lockingRecursively == true)
  {
  