Don't use MPProcessorsScheduled on Mac OS X

It's deprecated and it's not available on iOS anyway. The recommended
way of getting the number of processors online is via sysctl or
sysconf (both of which are just slightly below).

qthread_unix.cpp:397:13: error: 'MPProcessorsScheduled' is deprecated: first deprecated in Mac OS X 10.7 [-Werror,-Wdeprecated-declarations]

Change-Id: I4bf60985fbde155b78b840f3de3ff0a142b78b19
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
Thiago Macieira 2012-12-21 20:47:08 -08:00 committed by The Qt Project
parent 7b54571ec2
commit a891ef6920

View File

@ -392,10 +392,7 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW
{
int cores = -1;
#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
// Mac OS X
cores = MPProcessorsScheduled();
#elif defined(Q_OS_HPUX)
#if defined(Q_OS_HPUX)
// HP-UX
struct pst_dynamic psd;
if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) == -1) {
@ -405,7 +402,7 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW
cores = (int)psd.psd_proc_cnt;
}
#elif defined(Q_OS_BSD4)
// FreeBSD, OpenBSD, NetBSD, BSD/OS
// FreeBSD, OpenBSD, NetBSD, BSD/OS, Mac OS X
size_t len = sizeof(cores);
int mib[2];
mib[0] = CTL_HW;