#include<thread>
#include<iostream>
using namespace std;
class Test{
public:
void say(){
cout<< "hello c++11" <<endl;
}
static void startThread(){
thread th(bind(&Test::say,Test::Instance()));
th.join();
}
static Test* Instance(){
static Test t;
return &t;
}
protected:
Test(){}
};
int main()
{
Test::startThread();
return 0;
}
c++11单例模式创建线程
猜你喜欢
转载自blog.csdn.net/c_shell_python/article/details/102543458
今日推荐
周排行