message: CSharedUnlocker now uses the lockstack when DEBUG_LOCKORDER is defined
  some information about the original lock is lost when a CSharedUnlocker is used
diff: @@ -161,16 +161,6 @@ public:
  ~CDeferredSharedLocker() { unlock(); }
  };
  -// This class unlocks a shared lock for the duration of its life
  -class CSharedUnlocker
  -{
  - CSharedCriticalSection &cs;
  -
  -public:
  - CSharedUnlocker(CSharedCriticalSection &c) : cs(c) { cs.unlock_shared(); }
  - ~CSharedUnlocker() { cs.lock_shared(); }
  -};
  -
  /** Wrapped boost mutex: supports waiting but not recursive locking */
  typedef AnnotatedMixin<boost::mutex> CWaitableCriticalSection;
  @@ -240,6 +230,41 @@ void PrintLockContention(const char *pszName, const char *pszFile, unsigned int
  #define LOCK_WARN_TIME (500ULL * 1000ULL * 1000ULL)
  +// This class unlocks a shared lock for the duration of its life
  +class CSharedUnlocker
  +{
  + CSharedCriticalSection &cs;
  +#ifdef DEBUG_LOCKORDER
  + const char *pszName;
  + const char *pszFile;
  + unsigned int nLine;
  +#endif
  +
  +public:
  +#ifdef DEBUG_LOCKORDER
  + CSharedUnlocker(CSharedCriticalSection &c) : cs(c), pszName(""), pszFile("")
  +#else
  + CSharedUnlocker(CSharedCriticalSection &c) : cs(c)
  +#endif
  + {
  +#ifdef DEBUG_LOCKORDER
  + nLine = 0;
  + LeaveCritical((void *)(&cs));
  +#endif
  + cs.unlock_shared();
  + }
  + ~CSharedUnlocker()
  + {
  +#ifdef DEBUG_LOCKORDER
  + EnterCritical(pszName, pszFile, nLine, (void *)(&cs), LockType::SHARED, false, false);
  +#endif
  + cs.lock_shared();
  +#ifdef DEBUG_LOCKORDER
  + SetWaitingToHeld((void *)(&cs), false);
  +#endif
  + }
  +};
  +
  /** Wrapper around boost::unique_lock<Mutex> */
  template <typename Mutex>
  class SCOPED_LOCKABLE CMutexLock
  