Sometimes it could be useful to test quickly for thread specific id.
For example, if you are incrementing reference count, it seems to be possible to store thread specific id somewhere and then perform non-atomic increment if they match. (Disclaimer: MAYBE. I do not say it is really possible, it is just my current research subject).
Today I have found a nice and simple way how to obtain such id:
__thread int x;
&x is your ID
It is pretty fast too, because TLS pointers are stored in register (in fact, in gs segment on x86).