summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/os/macosx/macos.mm17
-rw-r--r--src/os/os2/os2.cpp5
-rw-r--r--src/os/unix/unix.cpp29
-rw-r--r--src/os/windows/win32.cpp8
-rw-r--r--src/thread.h6
-rw-r--r--src/video/win32_v.cpp2
6 files changed, 1 insertions, 66 deletions
diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm
index 7fb71fe9e..ae9d86ee8 100644
--- a/src/os/macosx/macos.mm
+++ b/src/os/macosx/macos.mm
@@ -206,23 +206,6 @@ bool GetClipboardContents(char *buffer, const char *last)
}
#endif
-uint GetCPUCoreCount()
-{
- uint count = 1;
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
- if (MacOSVersionIsAtLeast(10, 5, 0)) {
- count = (uint)[ [ NSProcessInfo processInfo ] activeProcessorCount ];
- } else
-#endif
- {
-#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
- count = MPProcessorsScheduled();
-#endif
- }
-
- return count;
-}
-
/**
* Check if a font is a monospace font.
* @param name Name of the font.
diff --git a/src/os/os2/os2.cpp b/src/os/os2/os2.cpp
index b62e83e5e..70c75a410 100644
--- a/src/os/os2/os2.cpp
+++ b/src/os/os2/os2.cpp
@@ -208,11 +208,6 @@ bool GetClipboardContents(char *buffer, const char *last)
const char *FS2OTTD(const char *name) {return name;}
const char *OTTD2FS(const char *name) {return name;}
-uint GetCPUCoreCount()
-{
- return 1;
-}
-
void OSOpenBrowser(const char *url)
{
// stub only
diff --git a/src/os/unix/unix.cpp b/src/os/unix/unix.cpp
index e20a6c1b5..aa63019f6 100644
--- a/src/os/unix/unix.cpp
+++ b/src/os/unix/unix.cpp
@@ -274,35 +274,6 @@ bool GetClipboardContents(char *buffer, const char *last)
#ifndef __APPLE__
-uint GetCPUCoreCount()
-{
- uint count = 1;
-#ifdef HAS_SYSCTL
- int ncpu = 0;
- size_t len = sizeof(ncpu);
-
-#ifdef OPENBSD
- int name[2];
- name[0] = CTL_HW;
- name[1] = HW_NCPU;
- if (sysctl(name, 2, &ncpu, &len, NULL, 0) < 0) {
- ncpu = 0;
- }
-#else
- if (sysctlbyname("hw.availcpu", &ncpu, &len, NULL, 0) < 0) {
- sysctlbyname("hw.ncpu", &ncpu, &len, NULL, 0);
- }
-#endif /* #ifdef OPENBSD */
-
- if (ncpu > 0) count = ncpu;
-#elif defined(_SC_NPROCESSORS_ONLN)
- long res = sysconf(_SC_NPROCESSORS_ONLN);
- if (res > 0) count = res;
-#endif
-
- return count;
-}
-
void OSOpenBrowser(const char *url)
{
pid_t child_pid = fork();
diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp
index 9847de567..d2cc434a2 100644
--- a/src/os/windows/win32.cpp
+++ b/src/os/windows/win32.cpp
@@ -725,14 +725,6 @@ const char *GetCurrentLocale(const char *)
return retbuf;
}
-uint GetCPUCoreCount()
-{
- SYSTEM_INFO info;
-
- GetSystemInfo(&info);
- return info.dwNumberOfProcessors;
-}
-
static WCHAR _cur_iso_locale[16] = L"";
diff --git a/src/thread.h b/src/thread.h
index cd2608221..53548cc06 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -30,12 +30,6 @@ inline void CSleep(int milliseconds)
}
/**
- * Get number of processor cores in the system, including HyperThreading or similar.
- * @return Total number of processor cores.
- */
-uint GetCPUCoreCount();
-
-/**
* Name the thread this function is called on for the debugger.
* @param name Name to set for the thread..
*/
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 5aec329b2..382c0d8fc 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -1149,7 +1149,7 @@ const char *VideoDriver_Win32::Start(const char * const *parm)
MarkWholeScreenDirty();
- _draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL && GetCPUCoreCount() > 1;
+ _draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL && std::thread::hardware_concurrency() > 1;
return NULL;
}