Changeset View
Changeset View
Standalone View
Standalone View
src/sync.h
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | public: | ||||
void unlock() UNLOCK_FUNCTION() { PARENT::unlock(); } | void unlock() UNLOCK_FUNCTION() { PARENT::unlock(); } | ||||
bool try_lock() EXCLUSIVE_TRYLOCK_FUNCTION(true) { | bool try_lock() EXCLUSIVE_TRYLOCK_FUNCTION(true) { | ||||
return PARENT::try_lock(); | return PARENT::try_lock(); | ||||
} | } | ||||
using UniqueLock = std::unique_lock<PARENT>; | using UniqueLock = std::unique_lock<PARENT>; | ||||
#ifdef __clang__ | |||||
//! For negative capabilities in the Clang Thread Safety Analysis. | |||||
//! A negative requirement uses the EXCLUSIVE_LOCKS_REQUIRED attribute, in | |||||
//! conjunction with the ! operator, to indicate that a mutex should not be | |||||
//! held. | |||||
const AnnotatedMixin &operator!() const { return *this; } | |||||
#endif // __clang__ | |||||
}; | }; | ||||
/** | /** | ||||
* Wrapped mutex: supports recursive locking, but no waiting | * Wrapped mutex: supports recursive locking, but no waiting | ||||
* TODO: We should move away from using the recursive lock by default. | * TODO: We should move away from using the recursive lock by default. | ||||
*/ | */ | ||||
using RecursiveMutex = AnnotatedMixin<std::recursive_mutex>; | using RecursiveMutex = AnnotatedMixin<std::recursive_mutex>; | ||||
▲ Show 20 Lines • Show All 250 Lines • Show Last 20 Lines |