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


C++ IThread::_noticeUpdate方法代码示例

本文整理汇总了C++中IThread::_noticeUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ IThread::_noticeUpdate方法的具体用法?C++ IThread::_noticeUpdate怎么用?C++ IThread::_noticeUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IThread的用法示例。


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

示例1: run

	//--------------------------------------------------------------------
	void IThread::run(void* _mythread)
	{
		// try to cast the given parameter to IThread pointer
		IThread* mythread = static_cast<IThread*>(_mythread);
		if (mythread == NULL)
		{
			NR_Log(Log::LOG_KERNEL, Log::LL_ERROR, "IThread: not valid parameter was specified for IThread::run(void*) method");
			return;
		}
		
		// now loop the thread until some messages occurs
		bool run = true;
		while (run){

			// kernel requested to suspend the thread
			if (mythread->mThreadState == THREAD_NEXT_SUSPEND)
			{
				// notice about suspending and go into sleep mode
				mythread->changeState(THREAD_SLEEPING);
				mythread->_noticeSuspend();

			// kernel requested to resume the execution
			}else if (mythread->mThreadState == THREAD_NEXT_RESUME)
			{
				// notice about resuming the work and start it again
				mythread->changeState(THREAD_RUNNING);
				mythread->_noticeResume();

			// kernel does not requested anything, so run the task
			}else if (mythread->mThreadState == THREAD_RUNNING)
			{
				mythread->_noticeUpdate();
			}

			// check for the stop message, then stop the thread
			// this is a reading mutex, so do not have to lock it
			run = mythread->mThreadState != THREAD_STOP;

			// we now yield the used timeslice for another threads
			yield(mythread);
		}
		
		// notice to stop the underlying task
		mythread->_noticeStop();

		// exit the thread
		//return NULL;
	}
开发者ID:cgart,项目名称:nrEngine,代码行数:49,代码来源:IThread.cpp


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