#include <iostream>
#include <thread>
#include <mutex>//加锁
using namespace std;
volatile int counter(0);//在内存中直接取得
mutex mtx;
void increase10Ktimes()
{
for(int i=0;i<10000;i++)
{
mtx.lock();
counter++;
mtx.unlock();
}
}
int main()
{
cout << "mainthread:" <<this_thread::get_id()<< endl;
// thread t(func);
// t.join();
// thread th[N];
// for(int i=0;i<N;i++)
// th[i]=thread(func);
// for(auto &t:th)
// //t.join();
// t.detach();
// cout << "mainthread:" <<this_thread::get_id(