mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-05-07 13:37:46 +00:00
Initial optimizations (Squashed to fix submodules)
This commit is contained in:
parent
db96c355ce
commit
2d4af4c88c
13 changed files with 426 additions and 558 deletions
|
|
@ -14,7 +14,10 @@ void shared_mutex::imp_lock_shared(s64 _old)
|
|||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
busy_wait();
|
||||
if (i != 0)
|
||||
{
|
||||
busy_wait();
|
||||
}
|
||||
|
||||
const s64 value = m_value.load();
|
||||
|
||||
|
|
@ -173,7 +176,10 @@ void shared_mutex::imp_lock(s64 _old)
|
|||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
busy_wait();
|
||||
if (i != 0)
|
||||
{
|
||||
busy_wait();
|
||||
}
|
||||
|
||||
const s64 value = m_value.load();
|
||||
|
||||
|
|
@ -236,6 +242,10 @@ void shared_mutex::imp_lock_degrade()
|
|||
|
||||
bool shared_mutex::try_lock_shared()
|
||||
{
|
||||
if (m_value < c_min) // Fast path
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Conditional decrement
|
||||
return m_value.fetch_op([](s64& value) { if (value >= c_min) value -= c_min; }) >= c_min;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue