diff --git a/rpcs3/Emu/Cell/lv2/sys_event.cpp b/rpcs3/Emu/Cell/lv2/sys_event.cpp index afc7fda33d..e6a75e6695 100644 --- a/rpcs3/Emu/Cell/lv2/sys_event.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_event.cpp @@ -292,6 +292,9 @@ error_code sys_event_queue_receive(ppu_thread& ppu, u32 equeue_id, vm::ptrmutex); if (!queue->unqueue(queue->sq, &ppu)) diff --git a/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp b/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp index ec6232fb81..f36e2ebd12 100644 --- a/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp @@ -171,6 +171,9 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm { if (lv2_obj::wait_timeout(timeout, &ppu)) { + // Wait for rescheduling + ppu.check_state(); + std::lock_guard lock(flag->mutex); if (!flag->unqueue(flag->sq, &ppu)) diff --git a/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp b/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp index 03c7151978..1692646367 100644 --- a/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp @@ -325,6 +325,9 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id { if (lv2_obj::wait_timeout(timeout, &ppu)) { + // Wait for rescheduling + ppu.check_state(); + std::lock_guard lock(cond->mutex); if (!cond->unqueue(cond->sq, &ppu)) diff --git a/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp b/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp index d44fc9c970..85606f9a5a 100644 --- a/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_lwmutex.cpp @@ -130,6 +130,9 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout) { if (lv2_obj::wait_timeout(timeout, &ppu)) { + // Wait for rescheduling + ppu.check_state(); + std::lock_guard lock(mutex->mutex); if (!mutex->unqueue(mutex->sq, &ppu)) diff --git a/rpcs3/Emu/Cell/lv2/sys_mutex.cpp b/rpcs3/Emu/Cell/lv2/sys_mutex.cpp index e83bbc7a6b..2e075952fa 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mutex.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_mutex.cpp @@ -165,6 +165,9 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout) { if (lv2_obj::wait_timeout(timeout, &ppu)) { + // Wait for rescheduling + ppu.check_state(); + std::lock_guard lock(mutex->mutex); if (!mutex->unqueue(mutex->sq, &ppu)) diff --git a/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp b/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp index 7b2522a024..6e07435cbd 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rwlock.cpp @@ -140,6 +140,9 @@ error_code sys_rwlock_rlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) { if (lv2_obj::wait_timeout(timeout, &ppu)) { + // Wait for rescheduling + ppu.check_state(); + std::lock_guard lock(rwlock->mutex); if (!rwlock->unqueue(rwlock->rq, &ppu)) @@ -337,6 +340,9 @@ error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout) { if (lv2_obj::wait_timeout(timeout, &ppu)) { + // Wait for rescheduling + ppu.check_state(); + std::lock_guard lock(rwlock->mutex); if (!rwlock->unqueue(rwlock->wq, &ppu)) diff --git a/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp b/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp index 7e125d4b74..aef6a5eb1b 100644 --- a/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_semaphore.cpp @@ -131,6 +131,9 @@ error_code sys_semaphore_wait(ppu_thread& ppu, u32 sem_id, u64 timeout) { if (lv2_obj::wait_timeout(timeout, &ppu)) { + // Wait for rescheduling + ppu.check_state(); + std::lock_guard lock(sem->mutex); if (!sem->unqueue(sem->sq, &ppu))