本文整理汇总了C++中CPUThread类的典型用法代码示例。如果您正苦于以下问题:C++ CPUThread类的具体用法?C++ CPUThread怎么用?C++ CPUThread使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPUThread类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sys_spu_thread_get_exit_status
//165
s32 sys_spu_thread_get_exit_status(u32 id, mem32_t status)
{
sc_spu.Warning("sys_spu_thread_get_exit_status(id=%d, status_addr=0x%x)", id, status.GetAddr());
if (!status.IsGood())
{
return CELL_EFAULT;
}
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
{
return CELL_ESRCH;
}
u32 res;
if (!(*(SPUThread*)thr).SPU.Out_MBox.Pop(res) || !thr->IsStopped())
{
return CELL_ESTAT;
}
status = res;
return CELL_OK;
}
示例2: sys_spu_thread_connect_event
int sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup)
{
sc_spu.Warning("sys_spu_thread_connect_event(id=0x%x,eq=0x%x,et=0x%x,spup=0x%x)", id, eq, et, spup);
EventQueue* equeue;
if(!sys_event.CheckId(eq, equeue))
{
return CELL_ESRCH;
}
if(spup > 63)
{
return CELL_EINVAL;
}
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
{
return CELL_ESRCH;
}
for(int j=0; j<equeue->pos; ++j)
{
if(!equeue->ports[j]->thread)
{
equeue->ports[j]->thread = thr;
return CELL_OK;
}
}
return CELL_EISCONN;
}
示例3: sys_spu_thread_bind_queue
s32 sys_spu_thread_bind_queue(u32 id, u32 eq_id, u32 spuq_num)
{
sc_spu.Warning("sys_spu_thread_bind_queue(id=%d, equeue_id=%d, spuq_num=0x%x)", id, eq_id, spuq_num);
EventQueue* eq;
if (!Emu.GetIdManager().GetIDData(eq_id, eq))
{
return CELL_ESRCH;
}
if (eq->type != SYS_SPU_QUEUE)
{
return CELL_EINVAL;
}
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
{
return CELL_ESRCH;
}
if (!(*(SPUThread*)thr).SPUQs.RegisterKey(eq, FIX_SPUQ(spuq_num)))
{
return CELL_EBUSY;
}
return CELL_OK;
}
示例4: 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;
}
}
示例5: lock
void CPUThreadManager::RemoveThread(const u32 id)
{
std::lock_guard<std::mutex> lock(m_mtx_thread);
for(u32 i=0; i<m_threads.GetCount(); ++i)
{
if(m_threads[i].m_wait_thread_id == id)
{
m_threads[i].Wait(false);
m_threads[i].m_wait_thread_id = -1;
}
if(m_threads[i].GetId() != id) continue;
CPUThread* thr = &m_threads[i];
#ifndef QT_UI
wxGetApp().SendDbgCommand(DID_REMOVE_THREAD, thr);
#endif
thr->Close();
m_threads.RemoveFAt(i);
break;
}
Emu.GetIdManager().RemoveID(id);
Emu.CheckStatus();
}
示例6: sys_spu_thread_write_snr
//184
int sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
{
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
{
return CELL_ESRCH;
}
if (number > 1)
{
return CELL_EINVAL;
}
if ((*(SPUThread*)thr).cfg.value & ((u64)1<<number))
{ //logical OR
(*(SPUThread*)thr).SPU.SNR[number].PushUncond_OR(value);
}
else
{ //overwrite
(*(SPUThread*)thr).SPU.SNR[number].PushUncond(value);
}
return CELL_OK;
}
示例7: lock
void CPUThreadManager::RemoveThread(const u32 id)
{
std::lock_guard<std::mutex> lock(m_mtx_thread);
CPUThread* thr = nullptr;
u32 thread_index = 0;
for (u32 i = 0; i < m_threads.size(); ++i)
{
if (m_threads[i]->m_wait_thread_id == id)
{
m_threads[i]->Wait(false);
m_threads[i]->m_wait_thread_id = -1;
}
if (m_threads[i]->GetId() != id) continue;
thr = m_threads[i];
thread_index = i;
}
if (thr)
{
#ifndef QT_UI
wxGetApp().SendDbgCommand(DID_REMOVE_THREAD, thr);
#endif
thr->Close();
m_threads.erase(m_threads.begin() + thread_index);
}
// Removing the ID should trigger the actual deletion of the thread
Emu.GetIdManager().RemoveID(id);
Emu.CheckStatus();
}
示例8: sys_ppu_thread_get_priority
s32 sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr)
{
sys_ppu_thread.Log("sys_ppu_thread_get_priority(thread_id=%lld, prio_addr=0x%x)", thread_id, prio_addr);
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
if(!thr) return CELL_ESRCH;
Memory.Write32(prio_addr, (s32)thr->GetPrio());
return CELL_OK;
}
示例9: GetCurrentPPCThread
PPCThread* GetCurrentPPCThread()
{
CPUThread* thread = GetCurrentCPUThread();
if(!thread || (thread->GetType() != CPU_THREAD_PPU && thread->GetType() != CPU_THREAD_SPU && thread->GetType() != CPU_THREAD_RAW_SPU))
{
throw wxString("GetCurrentPPCThread: bad thread");
}
return (PPCThread*)thread;
}
示例10: sys_ppu_thread_set_priority
int sys_ppu_thread_set_priority(u32 thread_id, int prio)
{
sysPrxForUser.Warning("sys_ppu_thread_set_priority(thread_id=%d, prio=%d)", thread_id, prio);
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
if(!thr) return CELL_ESRCH;
thr->SetPrio(prio);
return CELL_OK;
}
示例11: sys_ppu_thread_stop
s32 sys_ppu_thread_stop(u64 thread_id)
{
sysPrxForUser->Warning("sys_ppu_thread_stop(thread_id=%lld)", thread_id);
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
if(!thr) return CELL_ESRCH;
thr->Stop();
return CELL_OK;
}
示例12: sys_ppu_thread_set_priority
s32 sys_ppu_thread_set_priority(u64 thread_id, s32 prio)
{
sysPrxForUser->Log("sys_ppu_thread_set_priority(thread_id=%lld, prio=%d)", thread_id, prio);
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
if(!thr) return CELL_ESRCH;
thr->SetPrio(prio);
return CELL_OK;
}
示例13: sys_ppu_thread_rename
s32 sys_ppu_thread_rename(u64 thread_id, vm::ptr<const char> name)
{
sys_ppu_thread.Log("sys_ppu_thread_rename(thread_id=%d, name_addr=0x%x('%s'))", thread_id, name.addr(), name.get_ptr());
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
if (!thr) {
return CELL_ESRCH;
}
thr->SetThreadName(name.get_ptr());
return CELL_OK;
}
示例14: sys_ppu_thread_restart
s32 sys_ppu_thread_restart(u64 thread_id)
{
sys_ppu_thread.Warning("sys_ppu_thread_restart(thread_id=%lld)", thread_id);
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
if(!thr) return CELL_ESRCH;
thr->Stop();
thr->Run();
return CELL_OK;
}
示例15: sys_ppu_thread_restart
int sys_ppu_thread_restart(u32 thread_id)
{
sysPrxForUser.Warning("sys_ppu_thread_restart(thread_id=%d)", thread_id);
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
if(!thr) return CELL_ESRCH;
thr->Stop();
thr->Run();
return CELL_OK;
}