The Intel® C++ Compiler supports the storage class keyword __thread, which can be used in variable definitions and declarations. Variables defined and declared this way are automatically allocated locally to each thread:
__thread int i;
__thread struct state s;
extern __thread char *p;
The __thread keyword is only recognized when the GNU compatibility version is 3.3 or higher. You may need to specify the -gcc-version=330 compiler option to enable thread-local storage.
See also http://gcc.gnu.org/onlinedocs/gcc/Thread-Local.html.