From a945124a4212238f4d752ff2f2f3065c5adc1655 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 17 Dec 2014 18:47:52 -0800 Subject: Make the detection of the number of cores on Unix prettier This is a no-op change. It doesn't improve or worsen the code at all. Change-Id: Ifd5273842370ca9bce0ed74f2f2d54d453797948 Reviewed-by: Thiago Macieira --- src/corelib/thread/qthread_unix.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 9a14503584..e4338e10b4 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -395,14 +395,13 @@ Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW int QThread::idealThreadCount() Q_DECL_NOTHROW { - int cores = -1; + int cores = 1; #if defined(Q_OS_HPUX) // HP-UX struct pst_dynamic psd; if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) == -1) { perror("pstat_getdynamic"); - cores = -1; } else { cores = (int)psd.psd_proc_cnt; } @@ -414,7 +413,6 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW mib[1] = HW_NCPU; if (sysctl(mib, 2, &cores, &len, NULL, 0) != 0) { perror("sysctl"); - cores = -1; } #elif defined(Q_OS_IRIX) // IRIX @@ -449,9 +447,9 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW #else // the rest: Linux, Solaris, AIX, Tru64 cores = (int)sysconf(_SC_NPROCESSORS_ONLN); -#endif if (cores == -1) return 1; +#endif return cores; } -- cgit v1.2.3