[#BloombergLP-bslmt-ThreadUtil-setSpecific]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ThreadUtil.adoc[ThreadUtil]::setSpecific
:relfileprefix: ../../../
:mrdocs:

Associate the specified value with the key for the calling thread&period;

== Synopsis

Declared in `&lt;bslmt&lowbar;threadutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
setSpecific(
    xref:BloombergLP/bslmt/ThreadUtil/Key.adoc[Key] const& key,
    void const* value);
----

== Description

Associate the specified thread&hyphen;local `value` with the specified process&hyphen;wide `key`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; The value associated with a thread for a given key is 0 until it has been set by that thread using `setSpecific`&period; 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&period;

== Return Value

0 on success, and a non&hyphen;zero value otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key*
| process&hyphen;wide thread&hyphen;local key to set
| *value*
| thread&hyphen;local pointer value to associate with `key`
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
