TOC PREV NEXT INDEX

POSIX 1.c Migration Guide


Thread-Specific Data

Version Variations

POSIX.1c incorporates minor revisions to the thread-specific data-related functions versus the POSIX.4a interfaces, as shown in the following table:

Thread-Specific Data Function Changes  
POSIX.1c
POSIX.4a
int
pthread_key_create
(pthread_key_t *key,void
(*destructor)void *value))
int
pthread_keycreate
(pthread_key_t *key,void
(*destructor)(void *value))
int
pthread_key_delete
(pthread_key_t key)
No equivalent
int
pthread_setspecific
(pthread_key_t key,const void
*value)
int
pthread_setspecific
(pthread_key_t key,void *value)
void *
pthread_getspecific
(pthread_key_t key)
int
pthread_getspecific
(pthread_key_t key,void **value)

POSIX.4a does not provide a facility for deleting a thread-specific data key, which is provided in POSIX.1c by the pthread_key_delete() function.

Note: The pthread_key_delete() function in LynxOS is currently a no-op. Therefore, repeatedly deleting and recreating keys in a thread may cause the
per-thread key limit to be exceeded.

In POSIX.1c, the pthread_getspecific() function cannot return an error. If no thread-specific data value is associated with the specified key, pthread_getspecific() returns NULL.

Note: This also means that setting the value associated with a key to NULL using pthread_setspecific() results in an ambiguous return value from a subsequent call to pthread_getspecific() for that key.



LynuxWorks, Inc.
855 Branham Lane East
San Jose, CA 95138
http://www.lynuxworks.com
1.800.255.5969
TOC PREV NEXT INDEX