06 2015 档案

c++11 改进设计模式 Singleton模式
摘要:关于学习 《深入应用c++11》的代码笔记:c++11之前是这么实现的templateclass Singleton{public: static T* Instance(){ if (m_pInstance == nullptr) m_pInstance = new T(); return... 阅读全文

posted @ 2015-06-28 22:56 itdef 阅读(1109) 评论(0) 推荐(0)

c++11多线程学习笔记之四 生产消费者
摘要:#ifndef MY_QUEUE_H__#define MY_QUEUE_H__#include#include#include#include#include template class SyncQueue{public: SyncQueue(int maxSize = 10) :maxSiz... 阅读全文

posted @ 2015-06-22 12:48 itdef 阅读(329) 评论(0) 推荐(0)

c++11多线程学习笔记之三 condition_variable使用
摘要:从windows角度来说,condition_variable类似event。 阻塞等待出发,不过condition_variable可以批量出发。 代码如下: 显示如下: start...thread 7thread 3thread 2thread 9thread 6thread 5thread 阅读全文

posted @ 2015-06-08 21:21 itdef 阅读(458) 评论(0) 推荐(0)

c++11多线程学习笔记之二 mutex使用
摘要:// 1111111.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include int gcounter = 0;std::mutex gmtx; std::mutex gmtxOutput;voi... 阅读全文

posted @ 2015-06-07 21:29 itdef 阅读(319) 评论(0) 推荐(0)

c++11多线程学习笔记之一 thread基础使用
摘要:没啥好讲的 c++11 thread类的基本使用#include "stdafx.h"#include #include void Func(int n){ for (int i = 0; i < 3; ++i) std::cout << "func " << i << std::endl;}vo... 阅读全文

posted @ 2015-06-07 21:11 itdef 阅读(391) 评论(0) 推荐(0)

导航