mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-02 21:11:25 +12:00
Remove notifier
class
Poorly implemented condition variable.
This commit is contained in:
parent
b91661ae71
commit
a45f86a4a2
5 changed files with 2 additions and 178 deletions
|
@ -11,8 +11,6 @@ class cond_variable
|
|||
// Internal waiter counter
|
||||
atomic_t<u32> m_value{0};
|
||||
|
||||
friend class notifier;
|
||||
|
||||
protected:
|
||||
// Internal waiting function
|
||||
bool imp_wait(u32 _old, u64 _timeout) noexcept;
|
||||
|
@ -64,71 +62,6 @@ 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. Obsolete.
|
||||
class notifier
|
||||
{
|
||||
atomic_t<u32> m_counter{0};
|
||||
cond_variable m_cond;
|
||||
|
||||
bool imp_try_lock(u32 count);
|
||||
|
||||
void imp_unlock(u32 count);
|
||||
|
||||
u32 imp_notify(u32 count);
|
||||
|
||||
public:
|
||||
constexpr notifier() = default;
|
||||
|
||||
bool try_lock()
|
||||
{
|
||||
return imp_try_lock(max_readers);
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
imp_unlock(max_readers);
|
||||
}
|
||||
|
||||
bool try_lock_shared()
|
||||
{
|
||||
return imp_try_lock(1);
|
||||
}
|
||||
|
||||
void unlock_shared()
|
||||
{
|
||||
imp_unlock(1);
|
||||
}
|
||||
|
||||
bool wait(u64 usec_timeout = -1);
|
||||
|
||||
void notify_all()
|
||||
{
|
||||
if (m_counter)
|
||||
{
|
||||
imp_notify(-1);
|
||||
}
|
||||
|
||||
// Notify after imaginary "exclusive" lock+unlock
|
||||
m_cond.notify_all();
|
||||
}
|
||||
|
||||
void notify_one()
|
||||
{
|
||||
// TODO
|
||||
if (m_counter)
|
||||
{
|
||||
if (imp_notify(1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_cond.notify_one();
|
||||
}
|
||||
|
||||
static constexpr u32 max_readers = 0x7f;
|
||||
};
|
||||
|
||||
// Condition variable fused with a pseudo-mutex which is never supposed to be locked concurrently.
|
||||
class unique_cond
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue