summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-12-07 15:46:27 +0000
committerSimon Marlow <marlowsd@gmail.com>2011-12-07 16:06:42 +0000
commit8b48562e8cd773b4bc162edb4fc6d05a7654c7e1 (patch)
tree19bb15c2af5bee9f8fa12a071ebb5fd824b18ee5
parenteea40328004e3cad1fdd31004337e10e6ae5fc52 (diff)
downloadhaskell-8b48562e8cd773b4bc162edb4fc6d05a7654c7e1.tar.gz
Define getNumberOfProcessors() even when !THREADED_RTS
-rw-r--r--includes/rts/OSThreads.h11
-rw-r--r--rts/Linker.c1
-rw-r--r--rts/posix/OSThreads.c7
-rw-r--r--rts/win32/OSThreads.c5
4 files changed, 19 insertions, 5 deletions
diff --git a/includes/rts/OSThreads.h b/includes/rts/OSThreads.h
index c70f418229..cf72e1de69 100644
--- a/includes/rts/OSThreads.h
+++ b/includes/rts/OSThreads.h
@@ -183,8 +183,7 @@ extern void initCondition ( Condition* pCond );
extern void closeCondition ( Condition* pCond );
extern rtsBool broadcastCondition ( Condition* pCond );
extern rtsBool signalCondition ( Condition* pCond );
-extern rtsBool waitCondition ( Condition* pCond,
- Mutex* pMut );
+extern rtsBool waitCondition ( Condition* pCond, Mutex* pMut );
//
// Mutexes
@@ -201,7 +200,6 @@ void setThreadLocalVar (ThreadLocalKey *key, void *value);
void freeThreadLocalKey (ThreadLocalKey *key);
// Processors and affinity
-nat getNumberOfProcessors (void);
void setThreadAffinity (nat n, nat m);
#endif // !CMINUSMINUS
@@ -213,12 +211,17 @@ void setThreadAffinity (nat n, nat m);
#endif /* defined(THREADED_RTS) */
+#ifndef CMINUSMINUS
//
// Support for forkOS (defined regardless of THREADED_RTS, but does
// nothing when !THREADED_RTS).
//
-#ifndef CMINUSMINUS
int forkOS_createThread ( HsStablePtr entry );
+
+//
+// Returns the number of processor cores in the machine
+//
+nat getNumberOfProcessors (void);
#endif
#endif /* RTS_OSTHREADS_H */
diff --git a/rts/Linker.c b/rts/Linker.c
index f45c105bdc..7e3c7b1167 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -850,6 +850,7 @@ typedef struct _RtsSymbolVal {
SymI_HasProto(stg_readTVarIOzh) \
SymI_HasProto(resumeThread) \
SymI_HasProto(setNumCapabilities) \
+ SymI_HasProto(getNumberOfProcessors) \
SymI_HasProto(resolveObjs) \
SymI_HasProto(stg_retryzh) \
SymI_HasProto(rts_apply) \
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index e25cdc1e81..b1be93d04b 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -308,4 +308,9 @@ forkOS_createThread ( HsStablePtr entry STG_UNUSED )
return -1;
}
-#endif /* !defined(THREADED_RTS) */
+nat getNumberOfProcessors (void)
+{
+ return 1;
+}
+
+#endif
diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c
index c85dd2f854..fe24babb8b 100644
--- a/rts/win32/OSThreads.c
+++ b/rts/win32/OSThreads.c
@@ -308,4 +308,9 @@ forkOS_createThread ( HsStablePtr entry STG_UNUSED )
return -1;
}
+nat getNumberOfProcessors (void)
+{
+ return 1;
+}
+
#endif /* !defined(THREADED_RTS) */