• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetThreadId函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetThreadId函数的典型用法代码示例。如果您正苦于以下问题:C++ GetThreadId函数的具体用法?C++ GetThreadId怎么用?C++ GetThreadId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetThreadId函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: poweroffInit

int poweroffInit()
{
	int res;
	static int _init_count = -1;

	if(_init_count == _iop_reboot_count)
		return 0;
	_init_count = _iop_reboot_count;

	while(((res = SifBindRpc(&cd0, PWROFF_IRX, 0)) >= 0) && (cd0.server == NULL))
		nopdelay();

	ee_thread_t thread;
	ee_thread_status_t thisThread;

	ee_sema_t sema;

	// Terminate and delete any previously created threads
	if (powerOffThreadId >= 0) {
		TerminateThread(powerOffThreadId);
		DeleteThread(powerOffThreadId);
		powerOffThreadId = -1;
	}

	// Delete any previously created semaphores
	if (PowerOffSema >= 0)
	{
		DeleteSema(PowerOffSema);
		PowerOffSema = -1;
	}

	sema.init_count = 0;
	sema.max_count = 1;
	sema.option = 0;
	PowerOffSema = CreateSema(&sema);

	ReferThreadStatus(GetThreadId(), &thisThread);

	if (thisThread.current_priority == 0) {
		ChangeThreadPriority(GetThreadId(), 51);
		thread.initial_priority = 50;
	} else
		thread.initial_priority = thisThread.current_priority - 1;

	thread.stack_size = 512 * 16;
	thread.gp_reg = &_gp;
	thread.func = PowerOffThread;
	thread.stack = (void *)poffThreadStack;
	powerOffThreadId = CreateThread(&thread);
	StartThread(powerOffThreadId, NULL);
	
	DIntr();
	SifAddCmdHandler(POFF_SIF_CMD, _poff_intr_callback, NULL);
	EIntr();

	int autoShutdown = 0;
	SifCallRpc(&cd0, PWROFF_ENABLE_AUTO_SHUTOFF, 0, NULL, 0, &autoShutdown, sizeof(autoShutdown), 0, 0);
	
	return res;
}
开发者ID:EvertonSilva,项目名称:ps2sdk,代码行数:60,代码来源:poweroff.c


示例2: thrd_equal

int thrd_equal(thrd_t thr0, thrd_t thr1)
{
#if defined(_TTHREAD_WIN32_)
  return GetThreadId(thr0) == GetThreadId(thr1);
#else
  return pthread_equal(thr0, thr1);
#endif
}
开发者ID:mrwicked,项目名称:tinycthread,代码行数:8,代码来源:tinycthread.c


示例3: unabto_thread_equal

int unabto_thread_equal(unabto_thread_t thread1, unabto_thread_t thread2)
{
#ifdef WIN32
    return GetThreadId(thread1) == GetThreadId(thread2);
#else
    return pthread_equal(thread1, thread2);
#endif
}
开发者ID:BridgeHill,项目名称:unabto,代码行数:8,代码来源:unabto_thread.c


示例4: embb_thread_equal

int embb_thread_equal(const embb_thread_t* lhs, const embb_thread_t* rhs) {
  embb_thread_id_t idLhs = GetThreadId(lhs->embb_internal_handle);
  embb_thread_id_t idRhs = GetThreadId(rhs->embb_internal_handle);
  if (idLhs == idRhs) {
    return 1;
  }
  return 0;
}
开发者ID:danklmn,项目名称:embb,代码行数:8,代码来源:thread.c


示例5: SetThreadName

int DeviceManagerThread::Run()
{
    ThreadCommand::PopBuffer command;

    SetThreadName("OVR::DeviceManagerThread");
    LogText("OVR::DeviceManagerThread - running (ThreadId=%p).\n", GetThreadId());
    

    while(!IsExiting())
    {
        // PopCommand will reset event on empty queue.
        if (PopCommand(&command))
        {
            command.Execute();
        }
        else
        {
            bool commands = 0;
            do
            {
                int n = poll(&PollFds[0], PollFds.GetSize(), -1);

                for (int i = 0; i < PollFds.GetSize(); i++)
                {
                    if (PollFds[i].revents & POLLERR)
                    {
                        OVR_DEBUG_LOG(("poll: error on [%d]: %d", i, PollFds[i].fd));
                    }
                    else if (PollFds[i].revents & POLLIN)
                    {
                        if (FdNotifiers[i])
                            FdNotifiers[i]->OnEvent(i, PollFds[i].fd);
                        else if (i == 0) // command
                        {
                            char dummy[128];                            
                            read(PollFds[i].fd, dummy, 128);
                            commands = 1;
                        }
                    }

                    if (PollFds[i].revents & POLLHUP)
                        PollFds[i].events = 0;

                    if (PollFds[i].revents != 0)
                    {
                        n--;
                        if (n == 0)
                            break;
                    }
                }                    
            } while (PollFds.GetSize() > 0 && !commands);
        }
    }

    LogText("OVR::DeviceManagerThread - exiting (ThreadId=%p).\n", GetThreadId());
    return 0;
}
开发者ID:BigRobCoder,项目名称:ohmd-plugin,代码行数:57,代码来源:OVR_Linux_DeviceManager.cpp


示例6: gsiEnterCriticalSection

void gsiEnterCriticalSection(GSICriticalSection *theCrit) 
{ 
	// If we're not already in it, wait for it
	if (GetThreadId() != theCrit->mOwnerThread)
	{
		gsiWaitForSemaphore(theCrit->mSemaphore, 0);
		theCrit->mOwnerThread = GetThreadId();
	}

	// Increment entry count
	theCrit->mEntryCount++;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:12,代码来源:gsThreadPs2.c


示例7: sys_arch_sem_wait

u32_t
sys_arch_sem_wait(sys_sem_t Sema,u32_t u32Timeout)
{

	//Wait u32Timeout msec for the Sema to receive a signal.

	dbgprintf("sys_arch_sem_wait: Sema: %d, Timeout: %x (TID: %d)\n",Sema,u32Timeout,GetThreadId());

	if(u32Timeout==0)
	{

		//Wait with no timeouts.

		return	WaitSema(Sema)==0 ? 0:SYS_ARCH_TIMEOUT;
	}
	else if(u32Timeout==1)
	{

		//Poll.

		return	PollSema(Sema)==0 ? 0:SYS_ARCH_TIMEOUT;
	}
	else
	{

		//Use alarm to timeout.

		iop_sys_clock_t	ClockTicks;
		iop_sys_clock_t	Start;
		iop_sys_clock_t	End;
		int					iPID=GetThreadId();
		u32_t					u32WaitTime;

		GetSystemTime(&Start);
		USec2SysClock(u32Timeout*1000,&ClockTicks);
		SetAlarm(&ClockTicks,TimeoutHandler,(void*)iPID);

		if(WaitSema(Sema)!=0)
		{
			return	SYS_ARCH_TIMEOUT;
		}
		CancelAlarm(TimeoutHandler,(void*)iPID);
		GetSystemTime(&End);

		u32WaitTime=ComputeTimeDiff(&Start,&End);
		return	u32WaitTime<=u32Timeout ? u32WaitTime:u32Timeout;
	}
}
开发者ID:AzagraMac,项目名称:PS2_SDK,代码行数:48,代码来源:sys_arch.c


示例8: sys_sem_signal

void
sys_sem_signal(sys_sem_t Sema)
{
	dbgprintf("sys_sem_signal: Sema: %d (TID: %d)\n",Sema,GetThreadId());

	SignalSema(Sema);
}
开发者ID:AzagraMac,项目名称:PS2_SDK,代码行数:7,代码来源:sys_arch.c


示例9: Connect

bool CAsynPipe::Connect(const CAddress& Address)
{
	m_eState = eAPS_Connecting;
	CPipeThread* pThread = CPipeThreadMgr::Inst()->GetThread(GetThreadId());
	(new(pThread) CPipeConnectJob(GetLocalID(), Address, pThread))->Add(pThread);
	return true;
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:7,代码来源:CAsynPipe.cpp


示例10: updatePos_exec

void RankSystem::updatePos_init(RankStats* rr, Stats* s, bool sync)
{
	if(rr == NULL)	// Verify Pointer to RankStats
		return;

	if(s != NULL)	// NULL Stats Update (Only for Synchronization)
		rr->addStats(s);

	if(sync == true)
		updatePos_exec(rr);
	else
	{
		// Prevent Waiting on MAIN Thread
		HANDLE h_temp = CreateThread(NULL, 0, updatePos_thread, rr, CREATE_SUSPENDED, NULL);
		if(h_temp == NULL)
		{
			MF_SyncLog("updatePos_init: Couldn't create thread for updating Ranks");
		}
		else
		{
#ifdef _DEBUG
			MF_SyncLog("updatePos_init: Creating Thread #%d", GetThreadId(h_temp));
#endif
			SetThreadPriority(h_temp, THREAD_PRIORITY_LOWEST);
			ResumeThread(h_temp);
			CloseHandle(h_temp);
		}
	}
}
开发者ID:souvikdas95,项目名称:CSX_AMXX_UPDATING,代码行数:29,代码来源:CRank.cpp


示例11: rmInit

void rmInit() {
	gsGlobal = gsKit_init_global();

	rm_mode_table[RM_VMODE_AUTO].mode = gsGlobal->Mode;
	rm_mode_table[RM_VMODE_AUTO].height = gsGlobal->Height;

	dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC,
				D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF);

	// Initialize the DMAC
	dmaKit_chan_init(DMA_CHANNEL_GIF);

	rmSetMode(1);

	order = 0;

	aspectWidth = 1.0f;
	aspectHeight = 1.0f;

	shiftYVal = 1.0f;
	shiftY = &shiftYFunc;

	transX = 0.0f;
	transY = 0.0f;

	guiThreadID = GetThreadId();
	gsKit_add_vsync_handler(&rmOnVSync);
}
开发者ID:doctorxyz,项目名称:open-ps2-loader,代码行数:28,代码来源:renderman.c


示例12: thrd_is_current

int thrd_is_current(thrd_t thr) {
#if defined(_TTHREAD_WIN32_)
	return GetThreadId(thr) == GetCurrentThreadId();
#else	
	return (pthread_self() == thr);
#endif
}
开发者ID:Lionel-Coding-Lee,项目名称:libserdes,代码行数:7,代码来源:tinycthread.c


示例13: fileXio_Thread

void fileXio_Thread(void* param)
{
	int OldState;

	printf("fileXio: fileXio RPC Server v1.00\nCopyright (c) 2003 adresd\n");
	#ifdef DEBUG
		printf("fileXio: RPC Initialize\n");
	#endif

	SifInitRpc(0);

	RWBufferSize=DEFAULT_RWSIZE;
	CpuSuspendIntr(&OldState);
	rwbuf = AllocSysMemory(ALLOC_FIRST, RWBufferSize, NULL);
	CpuResumeIntr(OldState);
	if (rwbuf == NULL)
	{
		#ifdef DEBUG
  			printf("Failed to allocate memory for RW buffer!\n");
		#endif

		SleepThread();
	}

	SifSetRpcQueue(&qd, GetThreadId());
	SifRegisterRpc(&sd0, FILEXIO_IRX, &fileXio_rpc_server, fileXio_rpc_buffer, NULL, NULL, &qd);
	SifRpcLoop(&qd);
}
开发者ID:AKuHAK2,项目名称:ps2sdk,代码行数:28,代码来源:fileXio_iop.c


示例14: log_init_thread

void log_init_thread()
{
	if (!logger_attached)
		return;
	LPCWSTR pipeName = L"\\\\.\\pipe\\flog_server";
	for (;;)
	{
		hLoggerPipe = CreateFileW(pipeName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
		if (hLoggerPipe == INVALID_HANDLE_VALUE)
		{
			/* Non critical error code, just wait and try connecting again */
			if (GetLastError() != ERROR_PIPE_BUSY || !WaitNamedPipeW(pipeName, NMPWAIT_WAIT_FOREVER))
			{
				logger_attached = 0;
				break;
			}
			continue;
		}
		/* Send initial request */
		struct request request;
		request.magic = PROTOCOL_MAGIC;
		request.version = PROTOCOL_VERSION;
		request.pid = GetProcessId(GetCurrentProcess());
		request.tid = GetThreadId(GetCurrentThread());
		DWORD written;
		if (!WriteFile(hLoggerPipe, &request, sizeof(request), &written, NULL))
		{
			CloseHandle(hLoggerPipe);
			logger_attached = 0;
		}
		break;
	}
}
开发者ID:mt206,项目名称:flinux,代码行数:33,代码来源:log.c


示例15: InitThread

int InitThread(void)
{
	ee_sema_t sema;
	ee_thread_t thread;

	sema.max_count = 255;
	sema.init_count = 0;
	sema.option = (u32)"KernelTopThread";
	if((topSema = CreateSema(&sema)) < 0)
		return -1;

	thread.func = &topThread;
	thread.stack = stack;
	thread.stack_size = sizeof(stack);
	thread.gp_reg = &_gp;
	thread.option = (u32)"KernelTopThread";
	thread.initial_priority = 0;
	if((topId = CreateThread(&thread)) < 0)
	{
		DeleteSema(topSema);
		return -1;
	}

	topArg.requestOut = 0;
	topArg.requestIn = 0;
	StartThread(topId, &topArg);

	ChangeThreadPriority(GetThreadId(), 1);

	return topId;
}
开发者ID:AKuHAK,项目名称:ps2sdk,代码行数:31,代码来源:thread.c


示例16: traiter

	bool RenderThread::update()
	{
		/*
		- Tant qu'il n'y a pas de command
		-> je pop des task
		- Une fois que j'ai mes commandes
		-> pour chacunes d'elles
		-> je regarde si c'est a moi de les traiter (ex : changement de scene)
		-> si ca n'est pas a moi de les traiter
		-> je les passe au render context actif
		-> si il n'y a pas de render context actif, c'est que j'ai fait une erreur, et j'assert dans ta face :D
		*/

		_registerId();

		_run = true;
		_insideRun = true;
		DWORD threadId = GetThreadId(static_cast<HANDLE>(_threadHandle.native_handle()));
		SetThreadName(threadId, this->_name.c_str());

		TMQ::MessageBase *task = nullptr;

		while (_run && _insideRun)
		{
			SCOPE_profile_cpu_i("RenderTimer", "Update");

			if (TMQ::TaskManager::RenderThreadGetTask(task))
			{
				SCOPE_profile_cpu_i("RenderTimer", "Execute task");
				auto success = execute(task); // we receive a task that we cannot treat
				AGE_ASSERT(success);
			}
		}
		return true;
	}
开发者ID:Strongc,项目名称:AGE,代码行数:35,代码来源:RenderThread.cpp


示例17: sys_thread_new

//Create a new thread.
sys_thread_t
sys_thread_new(void (*pFunction)(void* pvArg), void* pvArg, int iPrio)
{
	iop_thread_t thp;
	int tid, rv;

    thp.attr = TH_C;
    thp.option = 0;
    thp.thread = pFunction;
    thp.stacksize = 0x900; // why this magic number??
    thp.priority = iPrio + SYS_THREAD_PRIO_BASE;

	dbgprintf("sys_thread_new: Thread new (TID: %d)\n",GetThreadId());

	if((tid = CreateThread(&thp)) < 0)
    {
		dbgprintf("sys_thread_new: CreateThread failed, EC: %d\n", tid);
		return	-1;
	}

	if((rv = StartThread(tid, pvArg)) < 0)
	{
		dbgprintf("sys_thread_new: StartThread failed, EC: %d\n", rv);
	    DeleteThread(tid);
	    return(-1);
	}

	thread_count++;

	return((sys_thread_t) tid);
}
开发者ID:AzagraMac,项目名称:PS2_SDK,代码行数:32,代码来源:sys_arch.c


示例18: sce_bgm_loop

/* ------------------------------------------------------------------------
   Main thread for the ezbgm module.
   After execution, initialize interrupt environment, register command, and
   then wait until there is a request from the EE.
   ------------------------------------------------------------------------ */
int sce_bgm_loop()
{
    sceSifQueueData qd;
    sceSifServeData sd;

    //-- Initialize interrupt environment in advance.

    CpuEnableIntr();
    EnableIntr( INUM_DMA_4 );
    EnableIntr( INUM_DMA_7 );

    //--- Register function that is called according to request


    sceSifInitRpc(0);

    sceSifSetRpcQueue( &qd, GetThreadId() );
    sceSifRegisterRpc( &sd, EZBGM_DEV, bgmFunc, (void*)gRpcArg, NULL, NULL, &qd );
    PRINTF(("goto bgm cmd loop\n"));

    //--- Command-wait loop

    sceSifRpcLoop(&qd);

    return 0;
}
开发者ID:thug1src,项目名称:thug,代码行数:31,代码来源:bgm_com.c


示例19: sys_thread_new

//Create a new thread.
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
{
	iop_thread_t thp;
	int tid, rv;

	thp.attr = TH_C;
	thp.option = 0;
	thp.thread = thread;
	thp.stacksize = stacksize;
	thp.priority = prio;

	dbgprintf("sys_thread_new: Thread new (TID: %d)\n", GetThreadId());

	if((tid = CreateThread(&thp)) < 0)
	{
		dbgprintf("sys_thread_new: CreateThread failed, EC: %d\n", tid);
		return ERR_MEM;
	}

	if((rv = StartThread(tid, arg)) < 0)
	{
		dbgprintf("sys_thread_new: StartThread failed, EC: %d\n", rv);
		DeleteThread(tid);
		return ERR_MEM;
	}

	return((sys_thread_t) tid);
}
开发者ID:AKuHAK2,项目名称:ps2sdk,代码行数:29,代码来源:sys_arch.c


示例20: sys_init

void
sys_init(void)
{
	int i;
	Timeout**	ppTimeout=&pFreeTimeouts;

	dbgprintf("sys_init: Initializing (TID: %d)\n",GetThreadId());

	for(i = 0; i < SYS_MAX_MESSAGES; i++)
	{
	    msg_pool[i].next = NULL;
	    msg_pool[i].sys_msg = NULL;
	}


	for	(i = 0; i < SYS_TIMEOUT_MAX; i++)
	{
		Timeout*		pTimeout=&aTimeouts[i];

		*ppTimeout=pTimeout;
		ppTimeout=&pTimeout->pNext;
	}

	*ppTimeout=NULL;
}
开发者ID:AzagraMac,项目名称:PS2_SDK,代码行数:25,代码来源:sys_arch.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetThreadLocale函数代码示例发布时间:2022-05-30
下一篇:
C++ GetThreadDesktop函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap