wxLogError(_("Can not retrieve thread scheduling policy."));
}
+#ifdef HAVE_THREAD_PRIORITY_FUNCTIONS
int min_prio = sched_get_priority_min(prio),
max_prio = sched_get_priority_max(prio);
(p_internal->GetPriority()*(max_prio-min_prio))/100;
pthread_attr_setschedparam(&attr, &sp);
}
+#endif // HAVE_THREAD_PRIORITY_FUNCTIONS
// create the new OS thread object
int rc = pthread_create(&p_internal->thread_id, &attr,
void wxThread::SetPriority(unsigned int prio)
{
- wxCHECK_RET( (WXTHREAD_MIN_PRIORITY <= prio) &&
- (prio <= WXTHREAD_MAX_PRIORITY), "invalid thread priority" );
+ wxCHECK_RET( ((int)WXTHREAD_MIN_PRIORITY <= (int)prio) &&
+ ((int)prio <= (int)WXTHREAD_MAX_PRIORITY),
+ "invalid thread priority" );
wxCriticalSectionLocker lock(m_critsect);
case STATE_RUNNING:
case STATE_PAUSED:
+#ifdef HAVE_THREAD_PRIORITY_FUNCTIONS
{
struct sched_param sparam;
sparam.sched_priority = prio;
wxLogError(_("Failed to set thread priority %d."), prio);
}
}
+#endif // HAVE_THREAD_PRIORITY_FUNCTIONS
break;
case STATE_EXITED:
return wxTHREAD_NOT_RUNNING;
default:
+#ifdef HAVE_PTHREAD_CANCEL
if ( pthread_cancel(p_internal->GetId()) != 0 )
+#endif
{
wxLogError(_("Failed to terminate a thread."));