Subj : Any overhead to pthread getspecific() (a.k.a. thread-local variables)? To : comp.programming.threads From : Adam Ierymenko Date : Mon May 09 2005 07:46 pm I am curious about what sort of overhead I should expect from using getspecific() frequently in a program? I am implementing multithreaded low-contention (nearly lock-free) memory management in C++ using thread-local memory pools and so this will be getting called frequently to get the current thread-local memory pool. I would assume that the cost of getspecific() is probably about equivalent to a function call plus an array lookup on most architectures, but I would like to see if anyone knows of any reason why it might be more. The OS is Linux, but I am curious about other architectures as well since I want this to be portable. .