mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
Change retire strategy in cond_variable::imp_wait (WIN32)
Instead of waiting infinitely, try and yield until success
This commit is contained in:
parent
39088e5005
commit
0b1c8bc676
1 changed files with 10 additions and 2 deletions
|
@ -21,9 +21,17 @@ bool cond_variable::imp_wait(u32 _old, u64 _timeout) noexcept
|
||||||
verify(HERE), rc == WAIT_TIMEOUT;
|
verify(HERE), rc == WAIT_TIMEOUT;
|
||||||
|
|
||||||
// Retire
|
// Retire
|
||||||
if (!m_value.fetch_op([](u32& value) { if (value) value--; }))
|
while (!m_value.fetch_op([](u32& value) { if (value) value--; }))
|
||||||
{
|
{
|
||||||
NtWaitForKeyedEvent(nullptr, &m_value, false, nullptr);
|
timeout.QuadPart = 0;
|
||||||
|
|
||||||
|
if (HRESULT rc2 = NtWaitForKeyedEvent(nullptr, &m_value, false, &timeout))
|
||||||
|
{
|
||||||
|
verify(HERE), rc2 == WAIT_TIMEOUT;
|
||||||
|
SwitchToThread();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue