From de9b5dbca34230b8213ce612036fccabdb6ee53b Mon Sep 17 00:00:00 2001 From: practicalswift Date: Thu, 16 May 2019 11:36:01 +0200 Subject: [PATCH] Make sure the compile-time locking promises given via LockAnnotation:s hold also in practice at runtime (ifdef DEBUG_LOCKORDER) --- src/sync.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sync.h b/src/sync.h index a4c22f67cc7..43473534db0 100644 --- a/src/sync.h +++ b/src/sync.h @@ -311,6 +311,9 @@ struct SCOPED_LOCKABLE LockAnnotation template explicit LockAnnotation(Mutex& mutex) EXCLUSIVE_LOCK_FUNCTION(mutex) { +#ifdef DEBUG_LOCKORDER + AssertLockHeld(mutex); +#endif } ~LockAnnotation() UNLOCK_FUNCTION() {} };