From: simonmar Date: Thu, 27 Oct 2005 08:00:03 +0000 (+0000) Subject: [project @ 2005-10-27 08:00:03 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~115 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=7f9c0373aacaf59f30aa9f275dcace505c8d5d89;p=ghc-hetmet.git [project @ 2005-10-27 08:00:03 by simonmar] Fix getThreadLocalVar() on Win32 - thanks for Krasimir for finding the bug. --- diff --git a/ghc/rts/win32/OSThreads.c b/ghc/rts/win32/OSThreads.c index e4cd76b..5559765 100644 --- a/ghc/rts/win32/OSThreads.c +++ b/ghc/rts/win32/OSThreads.c @@ -137,9 +137,13 @@ getThreadLocalVar (ThreadLocalKey *key) { void *r; r = TlsGetValue(*key); - if (r == NULL) { +#ifdef DEBUG + // r is allowed to be NULL - it can mean that either there was an + // error or the stored value is in fact NULL. + if (GetLastError() != NO_ERROR) { barf("getThreadLocalVar: key not found"); } +#endif return r; }