本文整理汇总了C++中vm::ptr::exchange方法的典型用法代码示例。如果您正苦于以下问题:C++ ptr::exchange方法的具体用法?C++ ptr::exchange怎么用?C++ ptr::exchange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vm::ptr
的用法示例。
在下文中一共展示了ptr::exchange方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sys_spinlock_initialize
void sys_spinlock_initialize(vm::ptr<atomic_t<u32>> lock)
{
sys_spinlock.Log("sys_spinlock_initialize(lock_addr=0x%x)", lock.addr());
// prx: set 0 and sync
lock->exchange(be_t<u32>::make(0));
}
示例2: sys_spinlock_unlock
void sys_spinlock_unlock(vm::ptr<atomic_t<u32>> lock)
{
sys_spinlock.Log("sys_spinlock_unlock(lock_addr=0x%x)", lock.addr());
// prx: sync and set 0
lock->exchange(be_t<u32>::make(0));
}
示例3: sys_spinlock_initialize
void sys_spinlock_initialize(vm::ptr<atomic_be_t<u32>> lock)
{
sysPrxForUser.Log("sys_spinlock_initialize(lock=*0x%x)", lock);
// prx: set 0 and sync
lock->exchange(be_t<u32>::make(0));
}
示例4: sys_spinlock_unlock
void sys_spinlock_unlock(vm::ptr<atomic_be_t<u32>> lock)
{
sysPrxForUser.Log("sys_spinlock_unlock(lock=*0x%x)", lock);
// prx: sync and set 0
lock->exchange(be_t<u32>::make(0));
g_sys_spinlock_wm.notify(lock.addr());
}
示例5: sys_spinlock_trylock
s32 sys_spinlock_trylock(vm::ptr<atomic_t<u32>> lock)
{
sys_spinlock.Log("sys_spinlock_trylock(lock_addr=0x%x)", lock.addr());
// prx: exchange with 0xabadcafe, translate exchanged value
if (lock->exchange(be_t<u32>::make(0xabadcafe)).data())
{
return CELL_EBUSY;
}
return CELL_OK;
}
示例6: sys_spinlock_trylock
s32 sys_spinlock_trylock(vm::ptr<std::atomic<be_t<u32>>> lock)
{
sys_spinlock.Log("sys_spinlock_trylock(lock_addr=0x%x)", lock.addr());
// prx: exchange with 0xabadcafe, translate exchanged value
if (lock->exchange(be_t<u32>::MakeFromBE(se32(0xabadcafe))).ToBE())
{
return CELL_EBUSY;
}
return CELL_OK;
}
示例7: sys_spinlock_lock
void sys_spinlock_lock(vm::ptr<atomic_be_t<u32>> lock)
{
sysPrxForUser.Log("sys_spinlock_lock(lock=*0x%x)", lock);
// prx: exchange with 0xabadcafe, repeat until exchanged with 0
while (lock->exchange(be_t<u32>::make(0xabadcafe)).data())
{
g_sys_spinlock_wm.wait_op(lock.addr(), [lock](){ return lock->read_relaxed().data() == 0; });
if (Emu.IsStopped())
{
sysPrxForUser.Warning("sys_spinlock_lock(lock=*0x%x) aborted", lock);
break;
}
}
}
示例8: sys_spinlock_lock
void sys_spinlock_lock(vm::ptr<atomic_t<u32>> lock)
{
sys_spinlock.Log("sys_spinlock_lock(lock_addr=0x%x)", lock.addr());
// prx: exchange with 0xabadcafe, repeat until exchanged with 0
while (lock->exchange(be_t<u32>::make(0xabadcafe)).data())
{
while (lock->read_relaxed().data())
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
break;
}
}
if (Emu.IsStopped())
{
sys_spinlock.Warning("sys_spinlock_lock(0x%x) aborted", lock.addr());
break;
}
}
}
示例9: sys_spinlock_lock
void sys_spinlock_lock(vm::ptr<std::atomic<be_t<u32>>> lock)
{
sys_spinlock.Log("sys_spinlock_lock(lock_addr=0x%x)", lock.addr());
// prx: exchange with 0xabadcafe, repeat until exchanged with 0
while (lock->exchange(be_t<u32>::MakeFromBE(se32(0xabadcafe))).ToBE())
{
while (lock->load(std::memory_order_relaxed).ToBE())
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
break;
}
}
if (Emu.IsStopped())
{
sys_spinlock.Warning("sys_spinlock_lock(0x%x) aborted", lock.addr());
break;
}
}
}