diff options
-rw-r--r-- | includes/rts/OSThreads.h | 11 | ||||
-rw-r--r-- | rts/Linker.c | 1 | ||||
-rw-r--r-- | rts/posix/OSThreads.c | 7 | ||||
-rw-r--r-- | rts/win32/OSThreads.c | 5 |
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) */ |