diff options
author | Liang Qi <liang.qi@nokia.com> | 2011-03-10 12:20:39 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-03-10 12:20:39 (GMT) |
commit | 177f6ec7a92e6108491a040e714485d840a40c71 (patch) | |
tree | 3a87c0eaca9abb29a41e70ab2e0278cb938fbc2d /src/corelib | |
parent | e1ce31e9ecf7e773895632fcf3087369a50c04f1 (diff) | |
download | Qt-177f6ec7a92e6108491a040e714485d840a40c71.zip Qt-177f6ec7a92e6108491a040e714485d840a40c71.tar.gz Qt-177f6ec7a92e6108491a040e714485d840a40c71.tar.bz2 |
Get the number of cores from HAL on Symbian.
Task-number: QTBUG-2199
Reviewed-by: Shane Kearns
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 5177339..9bfd85a 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -54,6 +54,11 @@ #include <private/qeventdispatcher_unix_p.h> #endif +#ifdef Q_OS_SYMBIAN +#include <hal.h> +#include <hal_data.h> +#endif + #include "qthreadstorage.h" #include "qthread_p.h" @@ -63,6 +68,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 @@ -422,8 +433,20 @@ int QThread::idealThreadCount() // as of aug 2008 Integrity only supports one single core CPU cores = 1; #elif defined(Q_OS_SYMBIAN) - // ### TODO - Get the number of cores from HAL? when multicore architectures (SMP) are supported - cores = 1; + if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3) { + TInt inumcpus; + TInt err; + err = HAL::Get(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) |