Thread-Specific Data [POSIX Section 17]

Functions Implemented

int pthread_key_create(pthread_key_t *key,
	               void (*destructor)(void *)); 
int pthread_setspecific(pthread_key_t key, const void *pointer); 
void *pthread_getspecific(pthread_key_t key); 
int pthread_key_delete(pthread_key_t key);


  • The value of PTHREAD_DESTRUCTOR_ITERATIONS is provided by the CYGNUM_POSIX_PTHREAD_DESTRUCTOR_ITERATIONS option. This controls the number of times that a key destructor will be called while the data item remains non-NULL.

  • The value of PTHREAD_KEYS_MAX is provided by the CYGNUM_POSIX_PTHREAD_KEYS_MAX option. This defines the maximum number of per-thread data items supported. The POSIX standard calls for this to be a minimum of 128, which is rather large for an embedded system. The default value for this option is set to 128 for compatibility but it should be reduced to a more usable value.

Documentation license for this page: Open Publication License