summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-03-18 15:51:36 +0000
committermread <qt-info@nokia.com>2011-03-18 15:54:25 +0000
commite37d500cb1da388fbd53ae9e58548a59df29f598 (patch)
tree52bab46fd73f59b7dfb25e6a68680a1562bebf83 /src/corelib/thread
parent89660713717dcbd6126d6a38f911b7a90dff7ba7 (diff)
Moving Symbian CPU core detection to qthread_symbian.cpp
This is resolving a merge issue where Symbian CPU core detection was added in one branch, but all the Symbian thread support was moved to a new file in another branch. Reviewed-by: Shane Kearns
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qthread_symbian.cpp21
-rw-r--r--src/corelib/thread/qthread_unix.cpp26
2 files changed, 17 insertions, 30 deletions
diff --git a/src/corelib/thread/qthread_symbian.cpp b/src/corelib/thread/qthread_symbian.cpp
index 75cb5eb699..1474b3613a 100644
--- a/src/corelib/thread/qthread_symbian.cpp
+++ b/src/corelib/thread/qthread_symbian.cpp
@@ -48,7 +48,14 @@
#include <private/qsystemerror_p.h>
#include <sched.h>
+#include <hal.h>
+#include <hal_data.h>
+// You only find these enumerations on Symbian^3 onwards, so we need to provide our own
+// to remain compatible with older releases. They won't be called by pre-Sym^3 SDKs.
+
+// HALData::ENumCpus
+#define QT_HALData_ENumCpus 119
QT_BEGIN_NAMESPACE
@@ -376,10 +383,16 @@ Qt::HANDLE QThread::currentThreadId()
int QThread::idealThreadCount()
{
- int cores = -1;
-
- // ### TODO - Get the number of cores from HAL? when multicore architectures (SMP) are supported
- cores = 1;
+ int cores = 1;
+
+ if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3) {
+ TInt inumcpus;
+ TInt err;
+ err = HAL::Get((HALData::TAttribute)QT_HALData_ENumCpus, inumcpus);
+ if (err == KErrNone) {
+ cores = qMax(inumcpus, 1);
+ }
+ }
return cores;
}
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index a1c64587d5..835378a617 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -50,11 +50,6 @@
#include <private/qeventdispatcher_unix_p.h>
-#ifdef Q_OS_SYMBIAN
-#include <hal.h>
-#include <hal_data.h>
-#endif
-
#include "qthreadstorage.h"
#include "qthread_p.h"
@@ -64,12 +59,6 @@
#include <sched.h>
#include <errno.h>
-// You only find these enumerations on Symbian^3 onwards, so we need to provide our own
-// to remain compatible with older releases. They won't be called by pre-Sym^3 SDKs.
-
-// HALData::ENumCpus
-#define QT_HALData_ENumCpus 119
-
#ifdef Q_OS_BSD4
#include <sys/sysctl.h>
#endif
@@ -378,21 +367,6 @@ int QThread::idealThreadCount()
#elif defined(Q_OS_INTEGRITY)
// as of aug 2008 Integrity only supports one single core CPU
cores = 1;
-#elif defined(Q_OS_SYMBIAN)
- if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3) {
- TInt inumcpus;
- TInt err;
- err = HAL::Get((HALData::TAttribute)QT_HALData_ENumCpus, inumcpus);
- if (err != KErrNone) {
- cores = 1;
- } else if ( inumcpus <= 0 ) {
- cores = 1;
- } else {
- cores = inumcpus;
- }
- } else {
- cores = 1;
- }
#elif defined(Q_OS_VXWORKS)
// VxWorks
# if defined(QT_VXWORKS_HAS_CPUSET)