[vlc-commits] thread: Have vlc_GetCPUCount make use of _SC_NPROCESSORS_ONLN
Brad Smith via vlc-devel
git at videolan.org
Sun Apr 18 07:00:51 UTC 2021
vlc | branch: master | Brad Smith via vlc-devel <vlc-devel at videolan.org> | Sat Apr 3 16:47:52 2021 -0400| [da0f38b3f2d168665beea4ce6a9b3cf42e9b8f67] | 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>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=da0f38b3f2d168665beea4ce6a9b3cf42e9b8f67
---
src/posix/thread.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/posix/thread.c b/src/posix/thread.c
index d617bd7292..28975b1f93 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -308,6 +308,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