Multithreaded Programming Guide

Exit Print View

Updated: July 2014
 
 

Setting the Thread-Specific Data Value

thr_setspecific(3C) binds value to the thread-specific data key, key, for the calling thread. For POSIX threads, see pthread_setspecific Syntax.

thr_setspecific Syntax

#include <thread.h>

int thr_setspecific(thread_key_t key, void *value);

thr_setspecific Return Values

thr_setspecific() returns 0 if successful. When any of the following conditions is detected, thr_setspecific() fails and returns the corresponding value.

ENOMEM

Description: Insufficient memory is available to associate value with keyp.

EINVAL

Description: keyp is invalid.