mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 01:38:37 +12:00
Put lv2_obj::awake calls under mutex
This commit is contained in:
parent
04c808b8ab
commit
b3f5d6d85b
3 changed files with 35 additions and 58 deletions
|
@ -192,17 +192,17 @@ error_code _sys_lwmutex_unlock(ppu_thread& ppu, u32 lwmutex_id)
|
|||
|
||||
sys_lwmutex.trace("_sys_lwmutex_unlock(lwmutex_id=0x%x)", lwmutex_id);
|
||||
|
||||
const auto mutex = idm::check<lv2_obj, lv2_lwmutex>(lwmutex_id, [&](lv2_lwmutex& mutex) -> cpu_thread*
|
||||
const auto mutex = idm::check<lv2_obj, lv2_lwmutex>(lwmutex_id, [&](lv2_lwmutex& mutex)
|
||||
{
|
||||
std::lock_guard lock(mutex.mutex);
|
||||
|
||||
if (const auto cpu = mutex.schedule<ppu_thread>(mutex.sq, mutex.protocol))
|
||||
{
|
||||
return cpu;
|
||||
mutex.awake(cpu);
|
||||
return;
|
||||
}
|
||||
|
||||
mutex.signaled |= 1;
|
||||
return nullptr;
|
||||
});
|
||||
|
||||
if (!mutex)
|
||||
|
@ -210,11 +210,6 @@ error_code _sys_lwmutex_unlock(ppu_thread& ppu, u32 lwmutex_id)
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if (mutex.ret)
|
||||
{
|
||||
mutex->awake(mutex.ret);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -224,18 +219,18 @@ error_code _sys_lwmutex_unlock2(ppu_thread& ppu, u32 lwmutex_id)
|
|||
|
||||
sys_lwmutex.warning("_sys_lwmutex_unlock2(lwmutex_id=0x%x)", lwmutex_id);
|
||||
|
||||
const auto mutex = idm::check<lv2_obj, lv2_lwmutex>(lwmutex_id, [&](lv2_lwmutex& mutex) -> cpu_thread*
|
||||
const auto mutex = idm::check<lv2_obj, lv2_lwmutex>(lwmutex_id, [&](lv2_lwmutex& mutex)
|
||||
{
|
||||
std::lock_guard lock(mutex.mutex);
|
||||
|
||||
if (const auto cpu = mutex.schedule<ppu_thread>(mutex.sq, mutex.protocol))
|
||||
{
|
||||
static_cast<ppu_thread*>(cpu)->gpr[3] = CELL_EBUSY;
|
||||
return cpu;
|
||||
mutex.awake(cpu);
|
||||
return;
|
||||
}
|
||||
|
||||
mutex.signaled |= 1 << 31;
|
||||
return nullptr;
|
||||
});
|
||||
|
||||
if (!mutex)
|
||||
|
@ -243,10 +238,5 @@ error_code _sys_lwmutex_unlock2(ppu_thread& ppu, u32 lwmutex_id)
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if (mutex.ret)
|
||||
{
|
||||
mutex->awake(mutex.ret);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue