[#BloombergLP-bslmt-ThreadUtil-createKey] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ThreadUtil.adoc[ThreadUtil]::createKey :relfileprefix: ../../../ :mrdocs: Load into the specified `key` a new process‐wide identifier that can be used to store (via `setSpecific`) and retrieve (via `getSpecific`) a pointer value local to each thread, and associate with the new key the specified `threadKeyCleanupFunction`, which will be called by each thread, if `threadKeyCleanupFunction` is non‐zero and the value associated with `key` for that thread is non‐zero, with the associated value as an argument, after the function passed to `create` has returned and before the thread terminates. Return 0 on success, and a non‐zero value otherwise. Note that multiple keys can be defined, which can result in multiple thread key cleanup functions being called for a given thread. == Synopsis Declared in `<bslmt_threadutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int createKey( xref:BloombergLP/bslmt/ThreadUtil/Key.adoc[Key]* key, xref:BloombergLP/bslmt/ThreadUtil/Destructor.adoc[Destructor] threadKeyCleanupFunction); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#