// Create and start the frame thread
int HAE_CreateFrameThread(void* context, HAE_FrameThreadProc proc)
{
    if (proc)
	{
	    long	error;

	    theFrameProc = proc;
	    error = thr_create(NULL, NULL, PV_NativeFrameThreadProc, NULL,
			       THR_BOUND | THR_NEW_LWP,
			       &theFrameThread);
	    if (error == 0) 
		{
		    error = thr_setprio(theFrameThread, 127);
		    if (error == 0)
			{
			    return 0;
			}
		    else
			{
			    DEBUG_STR("Failure to set priority of Solaris thread\n");
			}
		}
	    else
		{
		    DEBUG_STR("Failure to create Solaris thread\n");
		}
	    theFrameProc = NULL;
	}
    return -1;
}
Esempio n. 2
0
/* Set the current thread's priority. */
int
__objc_thread_set_priority(int priority)
{
  int sys_priority = 0;

  switch (priority)
    {
    case OBJC_THREAD_INTERACTIVE_PRIORITY:
      sys_priority = 300;
      break;
    default:
    case OBJC_THREAD_BACKGROUND_PRIORITY:
      sys_priority = 200;
      break;
    case OBJC_THREAD_LOW_PRIORITY:
      sys_priority = 1000;
      break;
    }

  /* Change priority */
  if (thr_setprio(thr_self(), sys_priority) == 0)
    return 0;
  else
    return -1;
}
Esempio n. 3
0
/******************************************************************
 * KpThreadSetPriority (Solaris Version)
 * 
 * Description
 *	
 *	This function sets the priority of the thread specified by thread to
 *  the value specified by newPriority. 
 *
 * Author
 *	mjb
 *
 * Created
 *	July 5, 1994
 *****************************************************************************/
KpInt32_t
KpThreadSetPriority (KpThread_t thread, KpInt32_t newPriority)
{

int		retVal;

	retVal = thr_setprio (thread, newPriority);
	if (0 != retVal) {
		return (KCMS_FAIL);
	}
	
	return (KCMS_SUCCESS);
	
} /* KpThreadSetPriority */
Esempio n. 4
0
/* wait for all benchmark threads to terminate */
void WaitForThreads(ThreadID tids[], unsigned tidCnt)
{
#ifdef __OS2__
	while (tidCnt--)
		DosWaitThread(&tids[tidCnt], DCWW_WAIT);

#elif defined(WIN32)
	WaitForMultipleObjects(tidCnt, tids, TRUE, INFINITE);

#elif defined(__sun)
	int prio;
	thr_getprio(thr_self(), &prio);
	thr_setprio(thr_self(), max(0, prio-1));
	while (tidCnt--)
		thr_join(0, NULL, NULL);

#elif defined(_POSIX_THREADS) || defined(_POSIX_REENTRANT_FUNCTIONS)
	while (tidCnt--)
		pthread_join(tids[tidCnt], NULL);

#endif
}