R.Wieser
2011-04-06 12:25:44 UTC
Hello All,
I've been wanting to use some thread-local storage, and found the TLS
related commands on MS-es website, in specific these ones :
TlsAlloc : http://msdn.microsoft.com/en-us/library/ms686801(v=vs.85).aspx
TlsSetValue : http://msdn.microsoft.com/en-us/library/ms686818(v=vs.85).aspx
The problem is that they seem to contradict one another. :-(
What I mean ? See the first paragraph of the remark section of the
TlsAlloc function, and compare it with the second paragraph of the remark
section of the TlsSetValue function : As far as I can tell the first tells
me *not* to regard the TLS as a Zero-based indexed array, while the second
seems to be saying its exactly that (with upto TLS_MINIMUM_AVAILABLE
guaranteed available slots).
Currently I get the feeling that I can just use TlsSetValue and TlsGetValue
without bothering to use TlsAlloc as long as I keep the slot-index lower
than TLS_MINIMUM_AVAILABLE, and that the "not opaque" remark to the TlsAlloc
function might (is it ?) only be valid when TlsFree is used.
Can anyone confirm it ? Is there perhaps any more/other info available ?
Regards,
Rudy Wieser
I've been wanting to use some thread-local storage, and found the TLS
related commands on MS-es website, in specific these ones :
TlsAlloc : http://msdn.microsoft.com/en-us/library/ms686801(v=vs.85).aspx
TlsSetValue : http://msdn.microsoft.com/en-us/library/ms686818(v=vs.85).aspx
The problem is that they seem to contradict one another. :-(
What I mean ? See the first paragraph of the remark section of the
TlsAlloc function, and compare it with the second paragraph of the remark
section of the TlsSetValue function : As far as I can tell the first tells
me *not* to regard the TLS as a Zero-based indexed array, while the second
seems to be saying its exactly that (with upto TLS_MINIMUM_AVAILABLE
guaranteed available slots).
Currently I get the feeling that I can just use TlsSetValue and TlsGetValue
without bothering to use TlsAlloc as long as I keep the slot-index lower
than TLS_MINIMUM_AVAILABLE, and that the "not opaque" remark to the TlsAlloc
function might (is it ?) only be valid when TlsFree is used.
Can anyone confirm it ? Is there perhaps any more/other info available ?
Regards,
Rudy Wieser