[vlc-devel] [PATCH v3 04/19] misc/thread_nocancel: Fall back to _SC_NPROCESSORS_ONLN

Dennis Hamester dhamester at jusst.de
Mon Mar 20 17:57:21 CET 2017


From: Dennis Hamester <dennis.hamester at startmail.com>

NaCl does not define _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN is
the best approximation we have got.
---
 src/misc/thread_nocancel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/misc/thread_nocancel.c b/src/misc/thread_nocancel.c
index 8056dbc209..c3c99cbfef 100644
--- a/src/misc/thread_nocancel.c
+++ b/src/misc/thread_nocancel.c
@@ -417,5 +417,9 @@ mtime_t mdate (void)
 
 unsigned vlc_GetCPUCount(void)
 {
+#ifdef _SC_NPROCESSORS_CONF
     return sysconf(_SC_NPROCESSORS_CONF);
+#else
+    return sysconf(_SC_NPROCESSORS_ONLN);
+#endif
 }
-- 
2.12.0



More information about the vlc-devel mailing list