[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13785] trunk/blender/source/blender/ blenlib/intern/threads.c: making auto detection of threads working on Os X
JLuc Peuriere
jlp at nerim.net
Wed Feb 20 17:07:42 CET 2008
Revision: 13785
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13785
Author: lukep
Date: 2008-02-20 17:07:42 +0100 (Wed, 20 Feb 2008)
Log Message:
-----------
making auto detection of threads working on Os X
sysconf exist but dont provide the needed flag
using sysctl instead
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/threads.c
Modified: trunk/blender/source/blender/blenlib/intern/threads.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/threads.c 2008-02-20 15:54:34 UTC (rev 13784)
+++ trunk/blender/source/blender/blenlib/intern/threads.c 2008-02-20 16:07:42 UTC (rev 13785)
@@ -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 @@
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)
More information about the Bf-blender-cvs
mailing list