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


C++ GetThreadPriority函数代码示例

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


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

示例1: JReference

JThread::JThread(int handle) 

  : JReference(handle) {

  priority = fromPlatform(

    GetThreadPriority((HANDLE)handle));

  ptarget = null;

}
开发者ID:neattools,项目名称:neattools,代码行数:11,代码来源:JThread.cpp

示例2: GetThreadPriority

int CThread::GetPriority() const
{
#ifdef _WIN32
	return GetThreadPriority(m_hThread);
#elif _LINUX
	struct sched_param thread_param;
	int policy;
	pthread_getschedparam( m_threadId, &policy, &thread_param );
	return thread_param.sched_priority;
#endif
}
开发者ID:FWGS,项目名称:libvinterface,代码行数:11,代码来源:threadtools.cpp

示例3: main_setRenderThreadPriority

void main_setRenderThreadPriority()
{
  int prios[]={
    GetThreadPriority(GetCurrentThread()),
    THREAD_PRIORITY_IDLE,
    THREAD_PRIORITY_LOWEST,
    THREAD_PRIORITY_NORMAL,
    THREAD_PRIORITY_HIGHEST,
  };
	SetThreadPriority(g_hThread,prios[cfg_render_prio]);
}
开发者ID:majek,项目名称:avs,代码行数:11,代码来源:main.cpp

示例4: MPOS_Start

static void MPOS_Start(void) {
    #if defined(RB_MSVC_WIN32)
	    hApp = GetCurrentProcess();
        hThread = GetCurrentThread();

        iPriorityClass = GetPriorityClass(hApp);
        iPriority = GetThreadPriority(hThread);

        if (iPriorityClass != 0) SetPriorityClass(hApp, REALTIME_PRIORITY_CLASS);
        if (iPriority != THREAD_PRIORITY_ERROR_RETURN) SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
	#elif defined(RB_MSVC_WINCE)
        hThread = GetCurrentThread();
        iPriority = GetThreadPriority(hThread);
        if (iPriority != THREAD_PRIORITY_ERROR_RETURN) SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
    #elif defined(RB_LINUX)
	    iPriority = getpriority(PRIO_PROCESS, 0); //lazy to check error:p
        setpriority(PRIO_PROCESS, 0, -20);
    #else
        //backup & disable all IRQ except COM port's IRQ
    #endif
}
开发者ID:mhk2010,项目名称:roboard-hexapod,代码行数:21,代码来源:com.cpp

示例5: sys_arch_timeouts

/*----------------------------------------------------------------------*/
struct sys_timeouts * sys_arch_timeouts(void)
{
  u8_t prio = GetThreadPriority(GetCurrentThread());
  u8_t offset = prio - LWIP_START_PRIO;
  if (prio == THREAD_PRIORITY_ERROR_RETURN) 
  {
    fprintf(stderr, "CreateThread failed with %d.\n", GetLastError()); 
    return &lwip_timeouts[LWIP_TASK_MAX];
  }
  if (offset >= 0 && offset < LWIP_TASK_MAX)
    return &lwip_timeouts[offset];
  return &lwip_timeouts[LWIP_TASK_MAX];
}
开发者ID:MetaEngine,项目名称:lwip-win32,代码行数:14,代码来源:sys_arch.c

示例6: GetThreadPriority

UInt32	CAPThread::GetScheduledPriority()
{
#if TARGET_OS_MAC
    return CAPThread::getScheduledPriority( mPThread, CAPTHREAD_SCHEDULED_PRIORITY );
#elif TARGET_OS_WIN32
	UInt32 theAnswer = 0;
	if(mThreadHandle != NULL)
	{
		theAnswer = GetThreadPriority(mThreadHandle);
	}
	return theAnswer;
#endif
}
开发者ID:cchaz003,项目名称:rivenx,代码行数:13,代码来源:CAPThread.cpp

示例7: GetThreadPriority

/** 等待给出的线程结束.
*/
void mvg::synch::joinThread(const TThreadHandle &threadHandle)
{
	if (threadHandle.isClear()) return;

	int prio = GetThreadPriority((HANDLE)threadHandle.hThread);
	if (THREAD_PRIORITY_ERROR_RETURN == prio)
		return; // 这边表示这个不是一个正在运行的线程

	DWORD ret = WaitForSingleObject((HANDLE)threadHandle.hThread, INFINITE);
	if (ret != WAIT_OBJECT_0)
		std::cerr << "[mvg::synch::joinThread] Error waiting for thread completion!" << std::endl;

}
开发者ID:yueying,项目名称:3DReconstruction,代码行数:15,代码来源:threads.cpp

示例8: pthread_self

pthread_t
pthread_self (void)
{
  pthread_t self;
  pthread_t nil = {NULL, 0};
  ptw32_thread_t * sp;

#if defined(_UWIN)
  if (!ptw32_selfThreadKey)
    return nil;
#endif

  sp = (ptw32_thread_t *) pthread_getspecific (ptw32_selfThreadKey);

  if (sp != NULL)
    {
      self = sp->ptHandle;
    }
  else
    {
      self = ptw32_new ();
      sp = (ptw32_thread_t *) self.p;

      if (sp != NULL)
	{
	  sp->implicit = 1;
	  sp->detachState = PTHREAD_CREATE_DETACHED;
	  sp->thread = GetCurrentThreadId ();

#if defined(NEED_DUPLICATEHANDLE)
	  sp->threadH = GetCurrentThread ();
#else
	  if (!DuplicateHandle (GetCurrentProcess (),
				GetCurrentThread (),
				GetCurrentProcess (),
				&sp->threadH,
				0, FALSE, DUPLICATE_SAME_ACCESS))
	    {
	      ptw32_threadReusePush (self);
	      return nil;
	    }
#endif

	  sp->sched_priority = GetThreadPriority (sp->threadH);
	  pthread_setspecific (ptw32_selfThreadKey, (void *) sp);
	}
    }

  return (self);

}				
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:51,代码来源:pthread_self.c

示例9: SDL_WM_SetCaption

void CUI_LoadMsg::enter(void) {
    need_refresh = 1;
    load_finished = 0;
//    setWindowTitle("zt - loading file...");
    SDL_WM_SetCaption("zt - [loading file]","zt - [loading file]");
    OldPriority = GetThreadPriority(GetCurrentThread());
    strtimer = strselect = 0;
    strtimer = SetTimer(NULL,strtimer,500,(TIMERPROC)TP_Load_Inc_Str);
    SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_BELOW_NORMAL);
    hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)load_thread,NULL,0,&iID); 
    while(load_lock) {
        SDL_Delay(1);
    }
}
开发者ID:cmicali,项目名称:ztracker,代码行数:14,代码来源:CUI_LoadMsg.cpp

示例10: lock

bool CThread::WaitForThreadExit(unsigned int milliseconds)
{
  bool bReturn = true;

  CSingleLock lock(m_CriticalSection);
  if (m_ThreadId && m_ThreadOpaque.handle != NULL)
  {
    // boost priority of thread we are waiting on to same as caller
    int callee = GetThreadPriority(m_ThreadOpaque.handle);
    int caller = GetThreadPriority(::GetCurrentThread());
    if(caller != THREAD_PRIORITY_ERROR_RETURN && caller > callee)
      SetThreadPriority(m_ThreadOpaque.handle, caller);

    lock.Leave();
    bReturn = m_TermEvent.WaitMSec(milliseconds);
    lock.Enter();

    // restore thread priority if thread hasn't exited
    if(callee != THREAD_PRIORITY_ERROR_RETURN && caller > callee && m_ThreadOpaque.handle)
      SetThreadPriority(m_ThreadOpaque.handle, callee);
  }
  return bReturn;
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:23,代码来源:ThreadImpl.cpp

示例11: EvalPriorityExpand

void EvalPriorityExpand(const void *data, qCtx *ctx, qStr *out, qArgAry *args) 
{
	if (ctx->GetSafeMode()) {ctx->Throw(out, 301, "function not available"); return;}
	int priority = THREAD_PRIORITY_ERROR_RETURN;

	CStr pname = (*args)[0];

	if (!stricmp(pname,"low")) {
		priority = THREAD_PRIORITY_BELOW_NORMAL;
	}
	if (!stricmp(pname,"high")) {
		priority = THREAD_PRIORITY_ABOVE_NORMAL;

	}
	if (!stricmp(pname,"normal")) {
		priority = THREAD_PRIORITY_NORMAL;
	}
	if (!stricmp(pname,"lowest")) {
		priority = THREAD_PRIORITY_LOWEST;

	}
	if (!stricmp(pname,"highest")) {
		priority = THREAD_PRIORITY_HIGHEST;
	}

	if (priority == THREAD_PRIORITY_ERROR_RETURN)
		ctx->Throw(out, 353, "Priority must be one of low, high, normal, lowest, highest");
	else {

		DWORD was = GetThreadPriority(GetCurrentThread());

		SetThreadPriority(GetCurrentThread(), priority);

		try {
			ctx->Parse(args->GetAt(1),out);
		} catch (qCtxExAbort ex) {
			SetThreadPriority(GetCurrentThread(), was);
			throw ex;
		} catch (qCtxEx ex) {
			SetThreadPriority(GetCurrentThread(), was);
			throw ex;
		} catch (...) {
			qCtxEx ex(354, "Unknown exception during priority shift");
			SetThreadPriority(GetCurrentThread(), was);
			throw ex;
		}

		SetThreadPriority(GetCurrentThread(), was);
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:50,代码来源:core.cpp

示例12: ThreadProc

//--------------------------------------------------------------------
// ThreadProc() - 本例之 5 個 threads 共用之 thread procedure
//--------------------------------------------------------------------
VOID ThreadProc(DWORD *ThreadArg)
{
RECT rect;
HDC  hDC;
HANDLE hBrush, hOldBrush;
DWORD dwThreadHits = 0;
char  cBuf[80];
int   iThreadNo, i;

   GetClientRect (_hWnd, &rect);
   hDC = GetDC (_hWnd);
   hBrush = CreateSolidBrush(RGB(*(ThreadArg), *(ThreadArg), *(ThreadArg)));  // 變化畫刷顏色
   hOldBrush = SelectObject(hDC, hBrush);

   switch (*ThreadArg) {
     case HIGHEST_THREAD   : iThreadNo = 0; break;
     case ABOVE_AVE_THREAD : iThreadNo = 1; break;
     case NORMAL_THREAD    : iThreadNo = 2; break;
     case BELOW_AVE_THREAD : iThreadNo = 3; break;
     case LOWEST_THREAD    : iThreadNo = 4; break;
   }

   // 顯示 thread 號碼及其優先權 (priority)
   wsprintf(cBuf, "T%d", iThreadNo);
   TextOut(hDC, *(ThreadArg), rect.bottom-150, cBuf, lstrlen(cBuf));
   wsprintf(cBuf, "P=%d", GetThreadPriority(_hThread[iThreadNo]));
   TextOut(hDC, *(ThreadArg), rect.bottom-130, cBuf, lstrlen(cBuf));

   do
   {
     dwThreadHits++;       // 計數器

     // 畫出四方形,代表 thread 的進行
     Rectangle(hDC, *(ThreadArg), rect.bottom-(dwThreadHits/10),
               *(ThreadArg)+0x40, rect.bottom);

     // 延遲...
     if (_uDelayType == SLEEPDELAY)
         Sleep(10);
     else if (_uDelayType == FORLOOPDELAY)
         for (i=0; i<30000; i++);
     else // _uDelayType == NODELAY)
         {   }
   } while (dwThreadHits < 1000);      // 巡迴  1000 次

   hBrush = SelectObject(hDC, hOldBrush);   // 恢復畫刷顏色
   DeleteObject (hBrush);
   ReleaseDC (_hWnd, hDC);
}
开发者ID:alannet,项目名称:example,代码行数:52,代码来源:MLTITHRD.C

示例13: initialize_thread_priority

/**
 * Initialize a thread's priority.
 *
 * Here the threading library priority value is converted to the appropriate
 * OS-specific value.
 *
 * @param[in] thread a thread
 * @return none
 *
 */
void
initialize_thread_priority(omrthread_t thread)
{
	int priority;

	thread->priority = J9THREAD_PRIORITY_NORMAL;

	if (priority_map[J9THREAD_PRIORITY_MIN] == priority_map[J9THREAD_PRIORITY_MAX]) {
		return;
	}

	priority = GetThreadPriority(thread->handle);

	thread->priority = omrthread_map_native_priority(priority);
}
开发者ID:LinHu2016,项目名称:omr,代码行数:25,代码来源:thrdsup.c

示例14: pthread_getschedparam

int pthread_getschedparam(pthread_t thread, int* policy, struct sched_param* param)
{
	if(policy)
	{
		DWORD pc = GetPriorityClass(GetCurrentProcess());
		*policy = (pc >= HIGH_PRIORITY_CLASS)? SCHED_FIFO : SCHED_RR;
	}
	if(param)
	{
		const HANDLE hThread = HANDLE_from_pthread(thread);
		param->sched_priority = GetThreadPriority(hThread);
	}

	return 0;
}
开发者ID:2asoft,项目名称:0ad,代码行数:15,代码来源:wpthread.cpp

示例15: GetThreadPriority

ThreadPriority HThread::GetPriority() const
{
    Int iWinPriority = GetThreadPriority( m_hThreadingObject );
    DebugAssert( iWinPriority != THREAD_PRIORITY_ERROR_RETURN );

    switch( iWinPriority ) {
        case THREAD_PRIORITY_IDLE:          return THREAD_PRIORITY_IDLETIME;
        case THREAD_PRIORITY_LOWEST:        return THREAD_PRIORITY_VERYLOW;
        case THREAD_PRIORITY_BELOW_NORMAL:  return THREAD_PRIORITY_LOW;
        case THREAD_PRIORITY_NORMAL:        return THREAD_PRIORITY_DEFAULT;
        case THREAD_PRIORITY_ABOVE_NORMAL:  return THREAD_PRIORITY_HIGH;
        case THREAD_PRIORITY_HIGHEST:       return THREAD_PRIORITY_VERYHIGH;
        case THREAD_PRIORITY_TIME_CRITICAL: return THREAD_PRIORITY_REALTIME;
        default: DebugAssert( false ); return THREAD_PRIORITY_DEFAULT;
    }
}
开发者ID:Shikifuyin,项目名称:Scarab-Engine,代码行数:16,代码来源:Threading.cpp


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