Associate the specified value with the key for the calling thread.

Synopsis

Declared in <bslmt_threadutil.h>

static
int
setSpecific(
    Key const& key,
    void const* value);

Description

Associate the specified thread‐local value with the specified process‐wide key. Return 0 on success, and a non‐zero value otherwise. The value associated with a thread for a given key is 0 until it has been set by that thread using setSpecific. The behavior is undefined unless this method is called outside any thread key cleanup function associated with any key by createKey, key was obtained from a successful call to createKey, and key has not been deleted.

Return Value

0 on success, and a non‐zero value otherwise

Parameters

Name

Description

key

process‐wide thread‐local key to set

value

thread‐local pointer value to associate with key

Created with MrDocs