mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
vm::atomic initial structure
This commit is contained in:
parent
dbd49a55c6
commit
b6f8700b8b
10 changed files with 156 additions and 30 deletions
|
|
@ -210,12 +210,12 @@ s32 sys_ppu_thread_create(vm::ptr<be_t<u64>> thread_id, u32 entry, u64 arg, s32
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
void sys_ppu_thread_once(PPUThread& CPU, vm::ptr<std::atomic<be_t<u32>>> once_ctrl, vm::ptr<void(*)()> init)
|
||||
void sys_ppu_thread_once(PPUThread& CPU, vm::ptr<vm::atomic<u32>> once_ctrl, vm::ptr<void(*)()> init)
|
||||
{
|
||||
sys_ppu_thread.Warning("sys_ppu_thread_once(once_ctrl_addr=0x%x, init_addr=0x%x)", once_ctrl.addr(), init.addr());
|
||||
|
||||
be_t<u32> old = be_t<u32>::MakeFromBE(se32(SYS_PPU_THREAD_ONCE_INIT));
|
||||
if (once_ctrl->compare_exchange_weak(old, be_t<u32>::MakeFromBE(se32(SYS_PPU_THREAD_DONE_INIT))))
|
||||
auto cmp = to_be<u32>(SYS_PPU_THREAD_ONCE_INIT);
|
||||
if (once_ctrl->compare_and_swap(cmp, to_be<u32>(SYS_PPU_THREAD_DONE_INIT)) == cmp)
|
||||
{
|
||||
init.call(CPU);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue