From: Vadim Zeitlin Date: Sat, 6 Mar 1999 00:30:23 +0000 (+0000) Subject: more FreeBSD thread fixes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/34f8c26e93e775036baf1bd9e50d08f0d38f6232 more FreeBSD thread fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index 3a7c4695b9..81a93b2ac5 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -454,6 +454,7 @@ wxThreadError wxThread::Create() 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); @@ -470,6 +471,7 @@ wxThreadError wxThread::Create() (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, @@ -496,8 +498,9 @@ wxThreadError wxThread::Run() 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); @@ -510,6 +513,7 @@ void wxThread::SetPriority(unsigned int prio) case STATE_RUNNING: case STATE_PAUSED: +#ifdef HAVE_THREAD_PRIORITY_FUNCTIONS { struct sched_param sparam; sparam.sched_priority = prio; @@ -520,6 +524,7 @@ void wxThread::SetPriority(unsigned int prio) wxLogError(_("Failed to set thread priority %d."), prio); } } +#endif // HAVE_THREAD_PRIORITY_FUNCTIONS break; case STATE_EXITED: @@ -618,7 +623,9 @@ wxThreadError wxThread::Kill() return wxTHREAD_NOT_RUNNING; default: +#ifdef HAVE_PTHREAD_CANCEL if ( pthread_cancel(p_internal->GetId()) != 0 ) +#endif { wxLogError(_("Failed to terminate a thread."));