Like this.
struct some_struct
{
// Other fields
.....
__thread int tl;
}
I\'m trying to do that but the compiler is giving me this error
According to the old Petzold book 'Programming Windows' (page 1241) you mark a variable as thread local by using the keywords: __declspec (thread). So for instance: __declspec (thread) int iGlobal = 1;
I doubt this could be done in a class though. You can also make the variable static too. [edit] just realized you are probably not running on windows... So I guess for anyone who needs an windows answer, this may be relevant.