{
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;
}
{
Capability *cap;
cap = rts_lock();
- rts_evalStableIO(cap, (HsStablePtr) entry, NULL);
+ cap = rts_evalStableIO(cap, (HsStablePtr) entry, NULL);
rts_unlock(cap);
return 0;
}