+int wxThread::GetCPUCount()
+{
+#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;
+
+ wxFFile file(_T("/proc/cpuinfo"));
+ if ( file.IsOpened() )
+ {
+ // slurp the whole file
+ wxString s;
+ if ( file.ReadAll(&s) )
+ {
+ // (ab)use Replace() to find the number of "processor: num" strings
+ size_t count = s.Replace(_T("processor\t:"), _T(""));
+ if ( count > 0 )
+ {
+ return count;
+ }
+
+ wxLogDebug(_T("failed to parse /proc/cpuinfo"));
+ }
+ else
+ {
+ wxLogDebug(_T("failed to read /proc/cpuinfo"));
+ }
+ }
+#endif // different ways to get number of CPUs
+
+ // unknown
+ return -1;
+}
+
+// VMS is a 64 bit system and threads have 64 bit pointers.
+// FIXME: also needed for other systems????
+#ifdef __VMS
+unsigned long long wxThread::GetCurrentId()
+{
+ return (unsigned long long)pthread_self();
+}
+
+#else // !__VMS
+
+unsigned long wxThread::GetCurrentId()