mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-30 20:34:45 +01:00
[orbis-kernel] shared_cv fixup
notify_one should work, notify_all probably doesn't.
This commit is contained in:
parent
9aafaea7f0
commit
99f520491c
|
|
@ -67,16 +67,13 @@ void shared_cv::impl_wake(shared_mutex &mutex, int _count) noexcept {
|
|||
unsigned do_wake = _m_locks == 0;
|
||||
if (auto r = syscall(SYS_futex, &m_value, FUTEX_CMP_REQUEUE, do_wake,
|
||||
&mutex, _count - do_wake, _old);
|
||||
r > 0) {
|
||||
if (mutex.is_free()) // Avoid deadlock (TODO: proper fix?)
|
||||
syscall(SYS_futex, &mutex, FUTEX_WAKE, 1, nullptr, 0, 0);
|
||||
if (!is_one) // Keep awaking waiters
|
||||
return impl_wake(mutex, INT_MAX);
|
||||
} else if (r == EAGAIN) {
|
||||
// Retry if something has changed (TODO: is it necessary?)
|
||||
r < _count) {
|
||||
// Keep awaking waiters
|
||||
return impl_wake(mutex, is_one ? 1 : INT_MAX);
|
||||
} else if (r < 0)
|
||||
std::abort(); // Unknown error
|
||||
} else if (mutex.is_free()) {
|
||||
// Avoid deadlock (TODO: proper fix?)
|
||||
syscall(SYS_futex, &mutex, FUTEX_WAKE, 1, nullptr, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace orbis::utils
|
||||
|
|
|
|||
Loading…
Reference in a new issue