summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-02-14 15:38:23 +0000
committermread <qt-info@nokia.com>2011-03-09 12:45:37 +0000
commit5ab8d2ac9e07ee7cb9ad442a651b9bdb2acc1d87 (patch)
treeeca20ce865728f6ad2cf36c0fb373fb130e4cb5c /src/corelib/thread
parenta8f22772c120b1560ec28eea6695fc1cde47a328 (diff)
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
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qthread_symbian.cpp19
-rw-r--r--src/corelib/thread/qwaitcondition_symbian.cpp14
2 files changed, 5 insertions, 28 deletions
diff --git a/src/corelib/thread/qthread_symbian.cpp b/src/corelib/thread/qthread_symbian.cpp
index d1e2eaa55e..b68453c0ad 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 <private/qcoreapplication_p.h>
-#if !defined(QT_NO_GLIB)
-# include "../kernel/qeventdispatcher_glib_p.h"
-#endif
-
#include <private/qeventdispatcher_symbian_p.h>
-
#include "qthreadstorage.h"
-
#include "qthread_p.h"
-
#include "qdebug.h"
#include <sched.h>
@@ -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 83fa597ca3..114811ef69 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)