c++11实现多线程开发
发布时间
阅读量:
阅读量
#include "iostream"
#include "thread"
#include "string"
#include "functional"
#include "mutex"
using namespace std;
std::mutex glock;
class Th{
public:
Th(){
}
void startThread(){
typedef std::function<void(int,std::string)> FN;
FN fn = [=](int id,std::string name){
volatile int count = 0;
while( (count++) < 5){
glock.lock();
std::cout << "fn: " << ", id=" << id << ", count=" << count
全部评论 (0)
还没有任何评论哟~
