From 5ab8d2ac9e07ee7cb9ad442a651b9bdb2acc1d87 Mon Sep 17 00:00:00 2001 From: mread Date: Mon, 14 Feb 2011 15:38:23 +0000 Subject: Fixed thread priority code The thread priority setting code was not dealing with the inherit case correctly. Now that it is, the wait condition delay hack has been removed. Task-number: QTBUG-13990 Reviewed-by: Shane Kearns --- src/corelib/thread/qthread_symbian.cpp | 19 ++++--------------- src/corelib/thread/qwaitcondition_symbian.cpp | 14 +------------- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/corelib/thread/qthread_symbian.cpp b/src/corelib/thread/qthread_symbian.cpp index d1e2eaa..b68453c 100644 --- a/src/corelib/thread/qthread_symbian.cpp +++ b/src/corelib/thread/qthread_symbian.cpp @@ -40,20 +40,11 @@ ****************************************************************************/ #include "qthread.h" - #include "qplatformdefs.h" - #include -#if !defined(QT_NO_GLIB) -# include "../kernel/qeventdispatcher_glib_p.h" -#endif - #include - #include "qthreadstorage.h" - #include "qthread_p.h" - #include "qdebug.h" #include @@ -281,11 +272,6 @@ Qt::HANDLE QThread::currentThreadId() return (Qt::HANDLE) (TUint) RThread().Id(); } -#if defined(QT_LINUXBASE) && !defined(_SC_NPROCESSORS_ONLN) -// LSB doesn't define _SC_NPROCESSORS_ONLN. -# define _SC_NPROCESSORS_ONLN 84 -#endif - int QThread::idealThreadCount() { int cores = -1; @@ -351,9 +337,12 @@ TThreadPriority calculateSymbianPriority(QThread::Priority priority) break; case QThread::HighestPriority: case QThread::TimeCriticalPriority: - default: symPriority = EPriorityMuchMore; break; + case QThread::InheritPriority: + default: + symPriority = RThread().Priority(); + break; } return symPriority; } diff --git a/src/corelib/thread/qwaitcondition_symbian.cpp b/src/corelib/thread/qwaitcondition_symbian.cpp index 83fa597..114811e 100644 --- a/src/corelib/thread/qwaitcondition_symbian.cpp +++ b/src/corelib/thread/qwaitcondition_symbian.cpp @@ -46,7 +46,6 @@ #include "qatomic.h" #include "qstring.h" #include "qelapsedtimer" -#include "qdebug.h" #include "qmutex_p.h" #include "qreadwritelock_p.h" @@ -69,10 +68,9 @@ public: RCondVar cond; int waiters; int wakeups; - int count; QWaitConditionPrivate() - : waiters(0), wakeups(0), count(0) + : waiters(0), wakeups(0) { qt_symbian_throwIfError(mutex.CreateLocal()); int err = cond.CreateLocal(); @@ -94,9 +92,7 @@ public: if (time == ULONG_MAX) { // untimed wait, loop because RCondVar::Wait may return before the condition is triggered do { - // qDebug() << "about to wait forever"; err = cond.Wait(mutex); - // qDebug() << "cond.Wait(mutex) returned"; } while (err == KErrNone && wakeups == 0); } else { unsigned long maxWait = KMaxTInt / 1000; @@ -105,11 +101,9 @@ public: waitTimer.start(); unsigned long waitTime = qMin(maxWait, time); // wait at least 1ms, as 0 means no wait - // qDebug() << "about to wait " << qMax(1ul, waitTime) * 1000; err = cond.TimedWait(mutex, qMax(1ul, waitTime) * 1000); // RCondVar::TimedWait may return before the condition is triggered, update the timeout with actual wait time time -= qMin((unsigned long)waitTimer.elapsed(), waitTime); - // qDebug() << "err=" << err << " time=" << time << " wakeups=" << wakeups; } while ((err == KErrNone && wakeups == 0) || (err == KErrTimedOut && time > 0)); } @@ -143,10 +137,7 @@ void QWaitCondition::wakeOne() d->mutex.Wait(); d->wakeups = qMin(d->wakeups + 1, d->waiters); d->cond.Signal(); - d->count++; d->mutex.Signal(); - if ((d->count%1000) == 999) - User::After(1); } void QWaitCondition::wakeAll() @@ -154,10 +145,7 @@ void QWaitCondition::wakeAll() d->mutex.Wait(); d->wakeups = d->waiters; d->cond.Broadcast(); - d->count++; d->mutex.Signal(); - if ((d->count%1000) == 999) - User::After(1); } bool QWaitCondition::wait(QMutex *mutex, unsigned long time) -- cgit v0.12