Skip to content

Commit

Permalink
Fix race in sys_lwcond_wait on error code
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 authored and Nekotekina committed Feb 16, 2019
1 parent 92ff7c4 commit 63a9421
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rpcs3/Emu/Cell/lv2/sys_lwcond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id
{
sys_lwcond.trace("_sys_lwcond_queue_wait(lwcond_id=0x%x, lwmutex_id=0x%x, timeout=0x%llx)", lwcond_id, lwmutex_id, timeout);

ppu.gpr[3] = CELL_OK;

std::shared_ptr<lv2_lwmutex> mutex;

const auto cond = idm::get<lv2_obj, lv2_lwcond>(lwcond_id, [&](lv2_lwcond& cond) -> cpu_thread*
Expand Down Expand Up @@ -294,8 +296,6 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id
cond->awake(*cond.ret);
}

ppu.gpr[3] = CELL_OK;

while (!ppu.state.test_and_reset(cpu_flag::signal))
{
if (ppu.is_stopped())
Expand Down

0 comments on commit 63a9421

Please sign in to comment.