diff options
author | Michael Lutz <michi@icosahedron.de> | 2019-03-17 15:14:17 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-04-06 11:27:39 +0200 |
commit | 967b27a2c12953da3584f4eaade37f94effc007a (patch) | |
tree | ea2daf0e2abb3a861a467575636353f3d183a75e /src/os/unix | |
parent | ae748166d06e756a0a6abab582dc341494a9b2da (diff) | |
download | openttd-967b27a2c12953da3584f4eaade37f94effc007a.tar.xz |
Codechange: C++11 STL has a function for getting the number of CPU cores.
Diffstat (limited to 'src/os/unix')
-rw-r--r-- | src/os/unix/unix.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
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(); |