std::atomic m_count 原子操作


#include
#include
#include

#include 
#include 
#include 
#include 
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

你可能感兴趣的:(C++11,c++)