RAD Studio |  |

__thread, Multithread Variables

Category

Keyword extensions

Description

The keyword __thread 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

Copy Code

     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.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!