C++的类静态成员变量可以使用thread_local进行修饰,表示这个成员变量是线程本地静态成员,例如:
class CTest { // other members ..... // declaration static thread_local int m1; } // initialize thread_local int CTest::m1 = 0;