mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-21 18:39:57 +00: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
@ -21,9 +21,17 @@ bool cond_variable::imp_wait(u32 _old, u64 _timeout) noexcept
|
||||
verify(HERE), rc == WAIT_TIMEOUT;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user