[Prev] [Contents] [Next]

Thread Specific Storage APIs

Thread specific storage is used by your threaded application when you need global storage that is `private' to a thread. The storage is allocated and stored by the thread, and can be associated with a destructor function. When the thread ends using one of the pthread mechanisms, the destructor function runs and cleans up the thread local storage. The thread specific storage can replace global storage, because any function in a thread that requests the thread specific storage will get the same value. Functions in another thread that request the thread specific storage will get the thread specific storage owned by the thread that they are called in.
pthread_getspecific()--Get Thread Local Storage Value by Key
pthread_key_create()--Create a Thread Local Storage Key
pthread_key_delete()--Delete Thread Local Storage Key
pthread_setspecific()--Set Thread Local Storage by Key



[Prev] [Contents] [Next]
Copyright © 1998, IBM Corporation. All rights reserved.
Comments? Contact
rchthrds@us.ibm.com