mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
merge #19249: Add means to handle negative capabilities in thread safety annotations
This commit is contained in:
parent
51fababb9c
commit
cbc6186b64
@ -100,6 +100,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
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__
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,6 +60,13 @@
|
|||||||
// and should only be used when sync.h Mutex/LOCK/etc are not usable.
|
// and should only be used when sync.h Mutex/LOCK/etc are not usable.
|
||||||
class LOCKABLE StdMutex : public std::mutex
|
class LOCKABLE StdMutex : public std::mutex
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
#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 StdMutex& operator!() const { return *this; }
|
||||||
|
#endif // __clang__
|
||||||
};
|
};
|
||||||
|
|
||||||
// StdLockGuard provides an annotated version of std::lock_guard for us,
|
// StdLockGuard provides an annotated version of std::lock_guard for us,
|
||||||
|
Loading…
Reference in New Issue
Block a user