I see. There certainly should have been a comment in the code about why pthread_cancel was chosen. I still think it's a particularly poor choice.
For glibc, I think pthread_getspecific or pthread_key_create are better choices. Those are much smaller functions that don't bring very much dead code into the link, and they are things actually used by libstdc++ et al. For supporting the interception cases, it's really not entirely safe to use any of the public API functions. Someone might have intercepted any of them in the same way as was cited for pthread_create. In glibc, we have exported __ names for various things, including __pthread_getspecific and __pthread_key_create. IMHO one of those is the best choice. They are part of the permanent public ABI and so won't ever go away, but they are not part of the public API that anyone writing an interceptor library would ever want to touch. Thanks, Roland