当前位置: 首页>>代码示例>>C++>>正文


C++ ptr::exchange方法代码示例

本文整理汇总了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));
}
开发者ID:gopalsr83,项目名称:rpcs3,代码行数:7,代码来源:sys_spinlock.cpp

示例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));
}
开发者ID:gopalsr83,项目名称:rpcs3,代码行数:7,代码来源:sys_spinlock.cpp

示例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));
}
开发者ID:William-Davidoffich,项目名称:rpcs3,代码行数:7,代码来源:sysPrxForUser.cpp

示例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());
}
开发者ID:William-Davidoffich,项目名称:rpcs3,代码行数:9,代码来源:sysPrxForUser.cpp

示例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;
}
开发者ID:gopalsr83,项目名称:rpcs3,代码行数:12,代码来源:sys_spinlock.cpp

示例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;
}
开发者ID:Aishou,项目名称:rpcs3,代码行数:12,代码来源:sys_spinlock.cpp

示例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;
		}
	}
}
开发者ID:William-Davidoffich,项目名称:rpcs3,代码行数:16,代码来源:sysPrxForUser.cpp

示例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;
		}
	}
}
开发者ID:gopalsr83,项目名称:rpcs3,代码行数:23,代码来源:sys_spinlock.cpp

示例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;
		}
	}
}
开发者ID:Aishou,项目名称:rpcs3,代码行数:23,代码来源:sys_spinlock.cpp


注:本文中的vm::ptr::exchange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。