本文整理汇总了C++中CPUThread::IsRunning方法的典型用法代码示例。如果您正苦于以下问题:C++ CPUThread::IsRunning方法的具体用法?C++ CPUThread::IsRunning怎么用?C++ CPUThread::IsRunning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPUThread
的用法示例。
在下文中一共展示了CPUThread::IsRunning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sys_spu_thread_write_ls
//181
s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
{
sc_spu.Log("sys_spu_thread_write_ls(id=%d, address=0x%x, value=0x%llx, type=0x%x)",
id, address, value, type);
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
{
return CELL_ESRCH;
}
if (!thr->IsRunning())
{
return CELL_ESTAT;
}
if (!(*(SPUThread*)thr).IsGoodLSA(address) || (address % type)) // +check alignment
{
return CELL_EINVAL;
}
switch (type)
{
case 1: (*(SPUThread*)thr).WriteLS8(address, value); return CELL_OK;
case 2: (*(SPUThread*)thr).WriteLS16(address, value); return CELL_OK;
case 4: (*(SPUThread*)thr).WriteLS32(address, value); return CELL_OK;
case 8: (*(SPUThread*)thr).WriteLS64(address, value); return CELL_OK;
default: return CELL_EINVAL;
}
}
示例2: sys_spu_thread_read_ls
//182
int sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
{
sc_spu.Log("sys_spu_thread_read_ls(id=%d, address=0x%x, value_addr=0x%x, type=0x%x)",
id, address, value.GetAddr(), type);
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
{
return CELL_ESRCH;
}
if (!thr->IsRunning())
{
return CELL_ESTAT;
}
if(!value.IsGood())
{
return CELL_EFAULT;
}
if (!(*(SPUThread*)thr).IsGoodLSA(address) || (address % type)) // +check alignment
{
return CELL_EINVAL;
}
switch (type)
{
case 1:
value = (*(SPUThread*)thr).ReadLS8(address);
return CELL_OK;
case 2:
value = (*(SPUThread*)thr).ReadLS16(address);
return CELL_OK;
case 4:
value = (*(SPUThread*)thr).ReadLS32(address);
return CELL_OK;
case 8:
value = (*(SPUThread*)thr).ReadLS64(address);
return CELL_OK;
default:
return CELL_EINVAL;
}
}