#include<cstdio>
#include<cstdlib>
#include<iostream>
#include <thread>
#include <mutex>
#include <list>
#include <atomic>
using namespace std;
class A
{
public:
//类型转换构造函数
A()
{
cout << "构造函数执行" << this << "threadid =" << std::this_thread::get_id() << endl;
}
A(const A & a)
{
cout << "拷贝构造函数执行" << this << "threadid =" << std::this_thread::get_id() << endl;
}
~A()
{
cout << "析构函数执行" << this << "threadid =" << std::this_thread::get_id() << endl;
}
public:
//输入
bool inMsgLUTProc(int & command)
{
for (int i = 0; i < 1000; ++i)
{
m_count += 1;
//++m_count;
//m_count = m_count + 1;
cout << m_count << endl;
}
return true;
}
//把数据从消息队列中取出的线程
bool o
std::atomic<int> m_count 原子操作
最新推荐文章于 2024-06-06 23:12:37 发布