Create a process‐wide key for thread‐local storage.

Synopsis

Declared in <bslmt_threadutilimpl_pthread.h>

static
int
createKey(
    Key* key,
    bslmt_KeyDestructorFunction destructor);

Description

Load, into the specified key, an identifier that can be used to store (setSpecific) and retrieve (getSpecific) a single thread‐specific pointer value. Associate with the identifier, the specified destructor if a non‐zero value is specified. Return 0 on success, and a non‐zero value otherwise.

Return Value

0 on success, and a non‐zero value otherwise

Parameters

Name

Description

key

receives the new process‐wide thread‐local key

destructor

optional destructor for key values

Created with MrDocs