Skip to content

Commit de9b5db

Browse files
Make sure the compile-time locking promises given via LockAnnotation:s hold also in practice at runtime (ifdef DEBUG_LOCKORDER)
1 parent 3a80944 commit de9b5db

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/sync.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ struct SCOPED_LOCKABLE LockAnnotation
311311
template <typename Mutex>
312312
explicit LockAnnotation(Mutex& mutex) EXCLUSIVE_LOCK_FUNCTION(mutex)
313313
{
314+
#ifdef DEBUG_LOCKORDER
315+
AssertLockHeld(mutex);
316+
#endif
314317
}
315318
~LockAnnotation() UNLOCK_FUNCTION() {}
316319
};

0 commit comments

Comments
 (0)