Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Luc Peurière <jlp@nerim.net>2008-02-20 19:07:42 +0300
committerJean-Luc Peurière <jlp@nerim.net>2008-02-20 19:07:42 +0300
commit1892df0e68e603ce7e026d5f49948fb795dc58cf (patch)
tree009084953d1089fb4640dc07a00cdb956aaa4f70
parente3e268253d5d4dc71ca530c744870b3b8ed710d9 (diff)
making auto detection of threads working on Os X
sysconf exist but dont provide the needed flag using sysctl instead
-rw-r--r--source/blender/blenlib/intern/threads.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 59951de617b..f1b0dff491b 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -43,6 +43,10 @@
#include "Windows.h"
#endif
+#ifdef __APPLE__
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
/* ********** basic thread control API ************
@@ -237,8 +241,18 @@ int BLI_system_thread_count( void )
SYSTEM_INFO info;
GetSystemInfo(&info);
t = (int) info.dwNumberOfProcessors;
-#else
+#else
+# ifdef __APPLE__
+ int mib[2];
+ size_t len;
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_NCPU;
+ len = sizeof(t);
+ sysctl(mib, 2, &t, &len, NULL, 0);
+# else
t = (int)sysconf(_SC_NPROCESSORS_ONLN);
+# endif
#endif
if (t>RE_MAX_THREAD)