From RAD Studio
Jump to: navigation, search

Go Up to Keywords, Alphabetical Listing Index

Note: __thread is not supported in Clang Compiler. Use __declspec(thread) instead.


Keyword Extensions


The __thread keyword is used in multithread programs to preserve a unique copy of global and static class variables. Each program thread maintains a private copy of a __thread variable for each thread.

The syntax is Type __thread variable__name. For example

 int __thread x;

This statement declares an integer type variable that will be global but private to each thread in the program in which the statement occurs.

See also