Changeset View
Changeset View
Standalone View
Standalone View
src/sync.h
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | explicit CSemaphoreGrant(CSemaphore &sema, bool fTry = false) | ||||
} | } | ||||
} | } | ||||
~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 | |||||
// locked (when it couldn't be determined otherwise). | |||||
struct SCOPED_LOCKABLE LockAnnotation { | |||||
template <typename Mutex> | |||||
explicit LockAnnotation(Mutex &mutex) EXCLUSIVE_LOCK_FUNCTION(mutex) { | |||||
#ifdef DEBUG_LOCKORDER | |||||
AssertLockHeld(mutex); | |||||
#endif | |||||
} | |||||
~LockAnnotation() UNLOCK_FUNCTION() {} | |||||
}; | |||||
#endif // BITCOIN_SYNC_H | #endif // BITCOIN_SYNC_H |