diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-12-07 12:01:53 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2018-08-03 07:11:37 -0500 |
commit | ba1f095aadf29bddb0bd8176d2e0b908f92a5623 (patch) | |
tree | 21c9b0b8ca96ecad2bdf0d339078c456eaa32cae /src/sync.h | |
parent | 41b88e93375d57db12da923f45f87b9a2db8e730 (diff) |
MOVEONLY Move AnnotatedMixin declaration
Move AnnotatedMixin closer to where it's used, and after the DEBUG_LOCKORDER
function declarations so it can call them.
Diffstat (limited to 'src/sync.h')
-rw-r--r-- | src/sync.h | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/sync.h b/src/sync.h index b8cb84f79f..c9a950799e 100644 --- a/src/sync.h +++ b/src/sync.h @@ -46,30 +46,6 @@ LEAVE_CRITICAL_SECTION(mutex); // no RAII // // /////////////////////////////// -/** - * Template mixin that adds -Wthread-safety locking - * annotations to a subset of the mutex API. - */ -template <typename PARENT> -class LOCKABLE AnnotatedMixin : public PARENT -{ -public: - void lock() EXCLUSIVE_LOCK_FUNCTION() - { - PARENT::lock(); - } - - void unlock() UNLOCK_FUNCTION() - { - PARENT::unlock(); - } - - bool try_lock() EXCLUSIVE_TRYLOCK_FUNCTION(true) - { - return PARENT::try_lock(); - } -}; - #ifdef DEBUG_LOCKORDER void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false); void LeaveCritical(); @@ -95,6 +71,30 @@ void static inline DeleteLock(void* cs) {} #define AssertLockNotHeld(cs) AssertLockNotHeldInternal(#cs, __FILE__, __LINE__, &cs) /** + * Template mixin that adds -Wthread-safety locking + * annotations to a subset of the mutex API. + */ +template <typename PARENT> +class LOCKABLE AnnotatedMixin : public PARENT +{ +public: + void lock() EXCLUSIVE_LOCK_FUNCTION() + { + PARENT::lock(); + } + + void unlock() UNLOCK_FUNCTION() + { + PARENT::unlock(); + } + + bool try_lock() EXCLUSIVE_TRYLOCK_FUNCTION(true) + { + return PARENT::try_lock(); + } +}; + +/** * Wrapped mutex: supports recursive locking, but no waiting * TODO: We should move away from using the recursive lock by default. */ |