Jump to content

  • Log In with Google      Sign In   
  • Create Account


thread_specific_ptr max indexes


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 mzworowski   Members   -  Reputation: 130

Like
0Likes
Like

Posted 13 August 2012 - 03:09 AM

Hi,

I'am working on a large project with an aim to introduce some multithreading. We started using boost TLS specific storage and I was wondering what is the actual maximum number of TLS indexes supported in Win platform (specifically xp and win7).
I checked the implementation and thread_specific_ptr is simply using standard windows TlsGetValue/TlsSetValue API but I'm concerned about what I found here:
http://msdn.microsof...9(v=vs.85).aspx

It states that the minimal guaranteed amount of indexes per process is only 64, and maximal number is 1088. We have definitly more then 200 dlls in the project and many of those need a TLS index.

So the question is: how can I check what is the actual number of TLS indexes supported on a specific platform?

Thank you in advance,

Sponsor:

#2 adeyblue   Members   -  Reputation: 518

Like
1Likes
Like

Posted 13 August 2012 - 10:06 AM

The MSDN text is slightly misleading. It's not a number of indexes between 64 and 1,088. It's either 64 or 1,088 indexes for all post Win2k editions of Windows. You get 64 guaranteed as that space is included with the TEB. When you request the 65th index, Windows allocates 1,024 more spaces for the requesting thread only. The additional 1,024 spaces are allocated for other threads when they either call TlsAlloc or TlsSetValue with an index of 64 or greater.

Sp depending on your programs' usage of the process heap, you'll either be able to afford the 4/8K for 1,088 slots for all threads, only some of your threads, or for none of them.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS