mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-02 21:11:25 +12:00
atomic_t<>: extend fetch_op to support cancellation
Use std::invoke inside atomic_op/fetch_op Remove op_fetch because it's easily replaced Add fetch_dec_sat algorithm (conditional decrement)
This commit is contained in:
parent
ed9fb8405b
commit
fb5cdf9769
10 changed files with 80 additions and 60 deletions
|
@ -237,7 +237,7 @@ void shared_mutex::imp_lock_degrade()
|
|||
bool shared_mutex::try_lock_shared()
|
||||
{
|
||||
// Conditional decrement
|
||||
return m_value.fetch_op([](s64& value) { if (value >= c_min) value -= c_min; }) >= c_min;
|
||||
return m_value.fetch_dec_sat(c_min - 1, c_min) >= c_min;
|
||||
}
|
||||
|
||||
bool shared_mutex::try_lock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue