Rename cond_one to unique_cond

Remove redundant in_cv in cellVdec
This commit is contained in:
Nekotekina 2019-06-02 23:21:13 +03:00
parent 0333942795
commit 31994dd3b2
3 changed files with 8 additions and 15 deletions

View file

@ -148,7 +148,7 @@ bool notifier::wait(u64 usec_timeout)
return res;
}
bool cond_one::imp_wait(u64 _timeout) noexcept
bool unique_cond::imp_wait(u64 _timeout) noexcept
{
// State transition: c_sig -> c_lock \ c_lock -> c_wait
const u32 _old = m_value.fetch_sub(1);
@ -173,7 +173,7 @@ bool cond_one::imp_wait(u64 _timeout) noexcept
});
}
void cond_one::imp_notify() noexcept
void unique_cond::imp_notify() noexcept
{
auto [old, ok] = m_value.fetch_op([](u32& v)
{

View file

@ -64,7 +64,7 @@ public:
static constexpr u64 max_timeout = u64{UINT32_MAX} / 1000 * 1000000;
};
// Pair of a fake shared mutex (only limited shared locking) and a condition variable
// Pair of a fake shared mutex (only limited shared locking) and a condition variable. Obsolete.
class notifier
{
atomic_t<u32> m_counter{0};
@ -129,7 +129,8 @@ public:
static constexpr u32 max_readers = 0x7f;
};
class cond_one
// Condition variable fused with a pseudo-mutex which is never supposed to be locked concurrently.
class unique_cond
{
enum : u32
{
@ -144,7 +145,7 @@ class cond_one
void imp_notify() noexcept;
public:
constexpr cond_one() = default;
constexpr unique_cond() = default;
void lock() noexcept
{
@ -158,7 +159,7 @@ public:
m_value = 0;
}
bool wait(std::unique_lock<cond_one>& lock, u64 usec_timeout = -1) noexcept
bool wait(std::unique_lock<unique_cond>& lock, u64 usec_timeout = -1) noexcept
{
AUDIT(lock.owns_lock());
AUDIT(lock.mutex() == this);