[#BloombergLP-bslmt-ThreadUtilImpl-04-createKey] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ThreadUtilImpl-04.adoc[ThreadUtilImpl<Platform::PosixThreads>]::createKey :relfileprefix: ../../../ :mrdocs: Create a process‐wide key for thread‐local storage. == Synopsis Declared in `<bslmt_threadutilimpl_pthread.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int createKey( xref:BloombergLP/bslmt/ThreadUtilImpl-04/Key.adoc[Key]* key, xref:BloombergLP/bslmt_KeyDestructorFunction.adoc[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 [cols="1,4"] |=== | Name| Description | *key* | receives the new process‐wide thread‐local key | *destructor* | optional destructor for key values |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#