Microsoft KB Archive/247653

From BetaArchive Wiki

INFO: If You Call TlsGetValue() on an Uninitialized TLS Slot, a NULL Value May Not Be Returned


The information in this article applies to:

  • Microsoft Windows CE Operating System versions 2.0, 2.11, 2.12


Under Windows CE versions 2.xx, if you call the TlsGetValue function on an uninitialized thread local storage (TLS) slot (that is, TlsSetValue has not yet been called to set a value at the slot), a NULL value may not be returned in all cases. The following is not recommended:

DWORD dwSlot = 0;

if ((dwSlot = TlsAlloc()) == -1)
    // Do error handling here.

if (TlsGetValue(dwSlot) != NULL)    // <== BAD assumption.
    // Assume slot contains valid data.


This is contrary to certain documentation on the subject. Under Windows 3.0, if you call TlsGetValue on uninitialized TLS slots, NULL is returned.

Additional query words:

Keywords : kbETK kbOSWinCEsearch kbDSupport kbGrpDSETK
Issue type : kbinfo
Technology : kbOSWinCE kbWinCESearch kbWinCE200 kbWinCE211 kbWinCE212

Last Reviewed: June 12, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.