projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add getNumberOfProcessors(), FIX MacOS X build problem (hopefully)
[ghc-hetmet.git]
/
rts
/
win32
/
OSThreads.c
diff --git
a/rts/win32/OSThreads.c
b/rts/win32/OSThreads.c
index
24fbabe
..
929b817
100644
(file)
--- a/
rts/win32/OSThreads.c
+++ b/
rts/win32/OSThreads.c
@@
-13,6
+13,7
@@
#if defined(THREADED_RTS)
#include "OSThreads.h"
#include "RtsUtils.h"
#if defined(THREADED_RTS)
#include "OSThreads.h"
#include "RtsUtils.h"
+#include <windows.h>
/* For reasons not yet clear, the entire contents of process.h is protected
* by __STRICT_ANSI__ not being defined.
/* For reasons not yet clear, the entire contents of process.h is protected
* by __STRICT_ANSI__ not being defined.
@@
-231,6
+232,20
@@
forkOS_createThread ( HsStablePtr entry )
(unsigned*)&pId) == 0);
}
(unsigned*)&pId) == 0);
}
+nat
+getNumberOfProcessors (void)
+{
+ static nat nproc = 0;
+
+ if (nproc == 0) {
+ SYSTEM_INFO si;
+ GetSystemInfo(&si);
+ nproc = si.dwNumberOfProcessors;
+ }
+
+ return nproc;
+}
+
#else /* !defined(THREADED_RTS) */
int
#else /* !defined(THREADED_RTS) */
int