?? pthread_getspecific.txt
字號:
--------------------------------------------------------------------------------AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1--------------------------------------------------------------------------------pthread_getspecific or pthread_setspecific SubroutinePurposeReturns and sets the thread-specific data associated with the specified key.LibraryThreads Library (libpthreads.a)Syntax#include <pthread.h>void *pthread_getspecific (key)pthread_key_t key;void *pthread_setspecific (key, value)pthread_key_t key;const void *value;DescriptionThe pthread_setspecific function associates a thread-specific value with a keyobtained via a previous call to pthread_key_create. Different threads may binddifferent values to the same key. These values are typically pointers to blocksof dynamically allocated memory that have been reserved for use by the callingthread.The pthread_getspecific function returns the value currently bound to thespecified key on behalf of the calling thread.The effect of calling pthread_setspecific or pthread_getspecific with a key valuenot obtained from pthread_key_create or after key has been deleted withpthread_key_delete is undefined.Both pthread_setspecific and pthread_getspecific may be called from athread-specific data destructor function. However, calling pthread_setspecificfrom a destructor may result in lost storage or infinite loops.Parameterskey Specifies the key to which the value is bound.value Specifies the new thread-specific value.Return ValuesThe function pthread_getspecific returns the thread-specific data valueassociated with the given key. If no thread-specific data value is associatedwith key, then the value NULL is returned. If successful, the pthread_setspecificfunction returns zero. Otherwise, an error number is returned to indicate theerror.Error CodesThe pthread_setspecific function will fail if:ENOMEM Insufficient memory exists to associate the value with the key.The pthread_setspecific function may fail if:EINVAL The key value is invalid.No errors are returned from pthread_getspecific.These functions will not return an error code of EINTR.Implementation SpecificsThese subroutines are part of the Base Operating System (BOS) Runtime.Related InformationThe pthread_key_create subroutine, the pthread.h file.Thread-Specific Data in AIX Version 4.3 General Programming Concepts: Writing andDebugging Programs.Threads Library Quick Reference in AIX Version 4.3 General Programming Concepts:Writing and Debugging Programs.--------------------------------------------------------------------------------
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -