Subj : Re: Are locks taken when using TLS To : comp.programming.threads From : roger.faulkner Date : Wed Apr 13 2005 09:45 am Robert wrote: > Hi > > I was wondering if there are any contention an locking issues > when using Thread local Storage > e.g. is a lock taken when doing pthread_getspecific > > I believe it is not like this in windows but how does this work on > e.g Linux ,AIX, Solaris, and HPUX is it the same? > > help in clearing this out would be very much appreachiated > > kind regards Robert Terminology correction: TLS == Thread Local Storage == thread-local data allocated with help from the compiler (using the '__thread' keyword). TSD == Thread Specific Data == stuff created by pthread_key_create() and pthread_setspecific() and returned by pthread_getspecific() To answer the question for Solaris: There is no locking involved in pthread_getspecific(). The interface has no contention and is quite fast. Roger Faulkner Sun Microsystems .