summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorGuoqing Zhang <guoqing.zhang@nokia.com>2011-03-16 11:29:20 (GMT)
committerGuoqing Zhang <guoqing.zhang@nokia.com>2011-03-16 11:29:20 (GMT)
commit39dcac49c9a20eaa9b347276d97547461c3904aa (patch)
tree8a0cc8574bed910f24438ee0fe5fb961021b3a65 /src/corelib/thread
parent82198dd1f7049cec89271b0ea82521752cc13c05 (diff)
parente318b0276c3d4a0db8660b4fa6d68f1784aee522 (diff)
downloadQt-39dcac49c9a20eaa9b347276d97547461c3904aa.zip
Qt-39dcac49c9a20eaa9b347276d97547461c3904aa.tar.gz
Qt-39dcac49c9a20eaa9b347276d97547461c3904aa.tar.bz2
Merge remote branch 'qt-master/master'
Conflicts: src/corelib/thread/qthread_unix.cpp
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qthread_unix.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 835378a..a1c6458 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -50,6 +50,11 @@
#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"
@@ -59,6 +64,12 @@
#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
@@ -367,6 +378,21 @@ 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)