View | Details | Raw Unified | Return to bug 197852 | Differences between
and this patch

Collapse All | Expand All

(-)devel/ChipmunkPhysics/files/patch-include_chipmunk_chipmunk.h (-2 / +3 lines)
Lines 1-10 Link Here
1
--- include/chipmunk/chipmunk.h.orig	2015-01-13 01:54:11 UTC
1
--- include/chipmunk/chipmunk.h.orig	2015-01-13 01:54:11 UTC
2
+++ include/chipmunk/chipmunk.h
2
+++ include/chipmunk/chipmunk.h
3
@@ -32,6 +32,8 @@
3
@@ -32,6 +32,9 @@
4
 #ifdef WIN32
4
 #ifdef WIN32
5
 	// For alloca().
5
 	// For alloca().
6
 	#include <malloc.h>
6
 	#include <malloc.h>
7
+#elif defined(__FreeBSD__)
7
+#elif defined(__DragonFly__) || defined(__FreeBSD__) \
8
+   || defined(__NetBSD__) || defined(__OpenBSD__) \
8
+	/* already included in <stdlib.h> */
9
+	/* already included in <stdlib.h> */
9
 #else
10
 #else
10
 	#include <alloca.h>
11
 	#include <alloca.h>
(-)devel/ChipmunkPhysics/files/patch-src_cpHastySpace.c (+41 lines)
Added Link Here
1
--- src/cpHastySpace.c.orig	2015-01-13 01:54:11 UTC
2
+++ src/cpHastySpace.c
3
@@ -5,8 +5,11 @@
4
 #include <stdio.h>
5
 
6
 #include <pthread.h>
7
-//#include <sys/param.h >
8
-#include <sys/sysctl.h>
9
+#ifdef _WIN32
10
+#include <windows.h>
11
+#else
12
+#include <unistd.h>
13
+#endif
14
 
15
 #include "chipmunk/chipmunk_private.h"
16
 #include "chipmunk/cpHastySpace.h"
17
@@ -313,15 +316,18 @@ cpHastySpaceSetThreads(cpSpace *space, u
18
 	
19
 	cpHastySpace *hasty = (cpHastySpace *)space;
20
 	HaltThreads(hasty);
21
-	
22
-#ifdef __APPLE__
23
+
24
 	if(threads == 0){
25
-		size_t size = sizeof(threads);
26
-		sysctlbyname("hw.ncpu", &threads, &size, NULL, 0);
27
-	}
28
+#if defined(_SC_NPROCESSORS_CONF)
29
+		threads = sysconf(_SC_NPROCESSORS_CONF);
30
+#elif defined(_WIN32)
31
+		SYSTEM_INFO siSysInfo;
32
+		GetSystemInfo(&siSysInfo);
33
+		threads = siSysInfo.dwNumberOfProcessors;
34
 #else
35
-	if(threads == 0) threads = 1;
36
+		threads = 1;
37
 #endif
38
+	}
39
 	
40
 	hasty->num_threads = (threads < MAX_THREADS ? threads : MAX_THREADS);
41
 	hasty->num_working = hasty->num_threads - 1;

Return to bug 197852