INFO: If You Call TlsGetValue() on an Uninitialized TLS Slot, a NULL Value May Not Be Returned |
Q247653
The information in this article applies to:
- Microsoft Windows CE Operating System versions 2.0, 2.11, 2.12
SUMMARY
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. } TlsFree(dwSlot);
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 |