Changeset View
Changeset View
Standalone View
Standalone View
src/sync.h
Show First 20 Lines • Show All 293 Lines • ▼ Show 20 Lines | public: | ||||
~CSemaphoreGrant() { Release(); } | ~CSemaphoreGrant() { Release(); } | ||||
operator bool() const { return fHaveGrant; } | operator bool() const { return fHaveGrant; } | ||||
}; | }; | ||||
// Utility class for indicating to compiler thread analysis that a mutex is | // Utility class for indicating to compiler thread analysis that a mutex is | ||||
// locked (when it couldn't be determined otherwise). | // locked (when it couldn't be determined otherwise). | ||||
struct SCOPED_LOCKABLE LockAnnotation { | struct SCOPED_LOCKABLE LockAssertion { | ||||
template <typename Mutex> | template <typename Mutex> | ||||
explicit LockAnnotation(Mutex &mutex) EXCLUSIVE_LOCK_FUNCTION(mutex) { | explicit LockAssertion(Mutex &mutex) EXCLUSIVE_LOCK_FUNCTION(mutex) { | ||||
#ifdef DEBUG_LOCKORDER | #ifdef DEBUG_LOCKORDER | ||||
AssertLockHeld(mutex); | AssertLockHeld(mutex); | ||||
#endif | #endif | ||||
} | } | ||||
~LockAnnotation() UNLOCK_FUNCTION() {} | ~LockAssertion() UNLOCK_FUNCTION() {} | ||||
}; | }; | ||||
#endif // BITCOIN_SYNC_H | #endif // BITCOIN_SYNC_H |