Changeset 98b9a3b in rtems
- Timestamp:
- 12/05/13 15:16:11 (10 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 262e250
- Parents:
- 25026906
- git-author:
- Sahil Patnayakuni <sahil.patnayakuni@…> (12/05/13 15:16:11)
- git-committer:
- Gedare Bloom <gedare@…> (12/05/13 15:16:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/posix_users/key.t
r25026906 r98b9a3b 8 8 @section Introduction 9 9 10 The key manager ... 10 The key manager allows for the creation and deletion of Data keys 11 specific to threads. 11 12 12 13 The directives provided by the key manager are: … … 62 63 @end table 63 64 65 @subheading DESCRIPTION 66 The pthread_key_create() function shall create a thread-specific data 67 key visible to all threads in the process. Key values provided by 68 pthread_key_create() are opaque objects used to locate thread-specific 69 data. Although the same key value may be used by different threads, the 70 values bound to the key by pthread_setspecific() are maintained on a 71 per-thread basis and persist for the life of the calling thread. 72 73 Upon key creation, the value NULL shall be associated with the new key 74 in all active threads. Upon thread creation, the value NULL shall be 75 associated with all defined keys in the new thread. 76 77 @subheading NOTES 78 An optional destructor function may be associated with each key value. 79 At thread exit, if a key value has a non-NULL destructor pointer, and 80 the thread has a non-NULL value associated with that key, the value of 81 the key is set to NULL, and then the function pointed to is called with 82 the previously associated value as its sole argument. The order of 83 destructor calls is unspecified if more than one destructor exists for 84 a thread when it exits. 85 64 86 @c 65 87 @c … … 74 96 75 97 int pthread_key_delete( 76 pthread_key_t key, 77 ); 98 pthread_key_t key); 78 99 @end example 79 100 … … 87 108 88 109 @subheading DESCRIPTION: 110 The pthread_key_delete() function shall delete a thread-specific data key 111 previously returned by pthread_key_create(). The thread-specific data 112 values associated with key need not be NULL at the time pthread_key_delete() 113 is called. It is the responsibility of the application to free any 114 application storage or perform any cleanup actions for data structures related 115 to the deleted key or associated thread-specific data in any 116 threads; this cleanup can be done either before or after 117 pthread_key_delete() is called. Any attempt to use key following the call to 118 pthread_key_delete() results in undefined behavior. 89 119 90 120 @subheading NOTES: 121 The pthread_key_delete() function shall be callable from within 122 destructor functions. No destructor functions shall be invoked by 123 pthread_key_delete(). Any destructor function that may have been 124 associated with key shall no longer be called upon thread exit. 125 91 126 92 127 @c … … 115 150 116 151 @subheading DESCRIPTION: 117 118 @subheading NOTES: 152 The pthread_setspecific() function shall associate a thread-specific value 153 with a key obtained via a previous call to pthread_key_create(). 154 Different threads may bind different values to the same key. These values 155 are typically pointers to blocks of dynamically allocated memory that 156 have been reserved for use by the calling thread. 157 158 @subheading NOTES: 159 The effect of calling pthread_setspecific() with a key value not obtained 160 from pthread_key_create() or after key has 161 been deleted with pthread_key_delete() is undefined. 162 163 pthread_setspecific() may be called from a thread-specific data 164 destructor function. Calling pthread_setspecific() from a thread-specific 165 data destructor routine may result either in lost storage (after at least 166 PTHREAD_DESTRUCTOR_ITERATIONS attempts at destruction) or in an infinite loop. 167 119 168 120 169 @c … … 145 194 146 195 @subheading DESCRIPTION: 196 The pthread_getspecific() function shall return the value currently bound to 197 the specified key on behalf of the calling thread. 147 198 148 199 @subheading NOTES: 149 200 The effect of calling pthread_getspecific() with a key value not obtained from 201 pthread_key_create() or after key has 202 been deleted with pthread_key_delete() is undefined. 203 204 pthread_getspecific() may be called from a thread-specific data destructor 205 function. A call to pthread_getspecific() for the thread-specific data key 206 being destroyed shall return the value NULL, unless the value is changed 207 (after the destructor starts) by a call to pthread_setspecific(). 208
Note: See TracChangeset
for help on using the changeset viewer.