Share via


thread

Microsoft Specific —>

**__declspec( thread )**declarator

Thread Local Storage (TLS) is the method by which each thread in a given multithreaded process allocates storage for thread-specific data.

The thread extended storage-class modifier is used to declare a thread local variable. The thread attribute must be used with the __declspec keyword.

The use of __declspec(thread) may interfere with delay loading of DLL imports**.**

For related information, see __declspec.

Example

The following code declares an integer thread local variable and initializes it with a value:

// Example of the thread attribute
__declspec( thread ) int tls_i = 1; 

See Also   Thread Local Storage (TLS)

END Microsoft Specific