From e37d500cb1da388fbd53ae9e58548a59df29f598 Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 18 Mar 2011 15:51:36 +0000 Subject: 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 --- src/corelib/thread/qthread_symbian.cpp | 21 +++++++++++++++++---- src/corelib/thread/qthread_unix.cpp | 26 -------------------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/corelib/thread/qthread_symbian.cpp b/src/corelib/thread/qthread_symbian.cpp index 75cb5eb..1474b36 100644 --- a/src/corelib/thread/qthread_symbian.cpp +++ b/src/corelib/thread/qthread_symbian.cpp @@ -48,7 +48,14 @@ #include #include +#include +#include +// 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 a1c6458..835378a 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -50,11 +50,6 @@ #include -#ifdef Q_OS_SYMBIAN -#include -#include -#endif - #include "qthreadstorage.h" #include "qthread_p.h" @@ -64,12 +59,6 @@ #include #include -// 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 #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) -- cgit v0.12