[vlc-commits] thread: Have vlc_GetCPUCount make use of _SC_NPROCESSORS_ONLN

Brad Smith git at videolan.org
Fri Apr 23 14:06:51 UTC 2021


vlc/vlc-3.0 | branch: master | Brad Smith <brad at comstyle.com> | Sat Apr  3 16:47:52 2021 -0400| [144bdd5d694949d82a42f310aa70882e4f46bad8] | committer: Rémi Denis-Courmont

thread: Have vlc_GetCPUCount make use of _SC_NPROCESSORS_ONLN

OpenBSD and other OS's use _SC_NPROCESSORS_ONLN to indicate the number
of online CPUs.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit 4824af4df2a4b4f5a3337e48fe5677da85e043e3)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=144bdd5d694949d82a42f310aa70882e4f46bad8
---

 src/posix/thread.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/posix/thread.c b/src/posix/thread.c
index dab8b71f97..a32861a69b 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -712,6 +712,8 @@ unsigned vlc_GetCPUCount(void)
         count = sysconf (_SC_NPROCESSORS_ONLN);
     free (cpulist);
     return count ? count : 1;
+#elif defined(_SC_NPROCESSORS_ONLN)
+    return sysconf(_SC_NPROCESSORS_ONLN);
 #elif defined(_SC_NPROCESSORS_CONF)
     return sysconf(_SC_NPROCESSORS_CONF);
 #else



More information about the vlc-commits mailing list