Like this.
struct some_struct
{
// Other fields
.....
__thread int tl;
}
I\'m trying to do that but the compiler is giving me this error
For C this makes not much sense, static
(= global) members are only a feature of C++. And so the new C11 standard (that introduces _Thread_local
) doesn't allow it. These beast are allowed basically everywhere were a variable with static storage duration is allowed.
For C++ this could make sense inside a class as analogous to a static
member, but if this is allowed by C++11 I have no idea.