Like this.
struct some_struct
{
// Other fields
.....
__thread int tl;
}
I\'m trying to do that but the compiler is giving me this error
gcc imposes the following restrictions on the use of __thread:
The
__threadspecifier may be applied to any global, file-scoped static, function-scoped static, or static data member of a class. It may not be applied to block-scoped automatic or non-static data member.
The __thread modifier is supported by multiple compiler. It is not inconceivable that the exact restrictions vary somewhat from compiler to compiler.