]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed detection of number of processors under Linux 2.6 (replaces patch 1663444)
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 7 Mar 2007 22:23:47 +0000 (22:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 7 Mar 2007 22:23:47 +0000 (22:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44648 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/unix/threadpsx.cpp

index 668df944db12e113083f45979d3b4f8f937801df..51f7f7a44450e66d895a2e8c718ecc3c16aa290e 100644 (file)
@@ -62,6 +62,7 @@ All:
 - Made wxTextFile work with unseekable files again (David Hart).
 - Added wxCONFIG_USE_SUBDIR flag to wxFileConfig (Giuseppe Bilotta).
 - Added wxSearchCtrl::[Get|Set]DescriptiveText.
+- Fixed detection of number of processors under Linux 2.6
 
 wxMSW
 
index ff291daa3f114c0d07ba5ac9309edb167b03f6ae..983ac3632ad9fc2fa5b7e518296d53c1c30be756 100644 (file)
@@ -988,7 +988,14 @@ void wxThread::Sleep(unsigned long milliseconds)
 
 int wxThread::GetCPUCount()
 {
-#if defined(__LINUX__) && wxUSE_FFILE
+#if defined(_SC_NPROCESSORS_ONLN)
+    // this works for Solaris and Linux 2.6
+    int rc = sysconf(_SC_NPROCESSORS_ONLN);
+    if ( rc != -1 )
+    {
+        return rc;
+    }
+#elif defined(__LINUX__) && wxUSE_FFILE
     // read from proc (can't use wxTextFile here because it's a special file:
     // it has 0 size but still can be read from)
     wxLogNull nolog;
@@ -1014,13 +1021,6 @@ int wxThread::GetCPUCount()
             wxLogDebug(_T("failed to read /proc/cpuinfo"));
         }
     }
-#elif defined(_SC_NPROCESSORS_ONLN)
-    // this works for Solaris
-    int rc = sysconf(_SC_NPROCESSORS_ONLN);
-    if ( rc != -1 )
-    {
-        return rc;
-    }
 #endif // different ways to get number of CPUs
 
     // unknown