more FreeBSD thread fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-03-06 00:30:23 +00:00
parent ab8247f4b9
commit 34f8c26e93

View File

@@ -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."));