Tag: 线程线程局部

您可以在类或结构中使用线程局部变量吗?

像这样。 struct some_struct { // Other fields ….. __thread int tl; } 我试图这样做,但编译器给了我这个错误。 ./cv.h:16:2: error: ‘__thread’ is only allowed on variable declarations __thread int tl;