X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fwin32%2FOSThreads.c;h=c18bab2d09d693521de254a844b88ec47da732f9;hb=31caec794c3978d55d79f715f21fb72948c9f300;hp=6f3629be4b5390df9c4fce92de5e17c6f792be04;hpb=e4fdc426413d178c86d3ba93702aad5eb17734bf;p=ghc-hetmet.git diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c index 6f3629b..c18bab2 100644 --- a/rts/win32/OSThreads.c +++ b/rts/win32/OSThreads.c @@ -13,6 +13,7 @@ #if defined(THREADED_RTS) #include "OSThreads.h" #include "RtsUtils.h" +#include /* For reasons not yet clear, the entire contents of process.h is protected * by __STRICT_ANSI__ not being defined. @@ -197,6 +198,17 @@ setThreadLocalVar (ThreadLocalKey *key, void *value) } } +void +freeThreadLocalKey (ThreadLocalKey *key) +{ + BOOL r; + r = TlsFree(*key); + if (r == 0) { + DWORD dw = GetLastError(); + barf("freeThreadLocalKey failed: %lu", dw); + } +} + static unsigned __stdcall forkOS_createThreadWrapper ( void * entry ) @@ -220,6 +232,26 @@ forkOS_createThread ( HsStablePtr entry ) (unsigned*)&pId) == 0); } +nat +getNumberOfProcessors (void) +{ + static nat nproc = 0; + + if (nproc == 0) { + SYSTEM_INFO si; + GetSystemInfo(&si); + nproc = si.dwNumberOfProcessors; + } + + return nproc; +} + +void +setThreadAffinity (nat n STG_UNUSED, nat m STG_UNUSED) +{ + /* ToDo */ +} + #else /* !defined(THREADED_RTS) */ int