namespace{//strand提供串行执行,能够保证线程安全,同时被post或dispatch的方法,不会被并发的执行.//io_service不能保证线程安全boost::asio::io_servicem_service;boost::asio::strandm_strand(m_serv...
分类:
其他好文 时间:
2015-04-28 01:50:26
阅读次数:
2077
This tutorial demonstrates the use of the boost::asio::strand class to synchronise callback handlers in a multithreaded program.The previous four tuto...
分类:
其他好文 时间:
2015-04-28 01:38:34
阅读次数:
168
#include#includeintmain(){boost::asio::io_serviceio;boost::asio::deadline_timertimer(io,boost::posix_time::seconds(3));timer.wait();std::coutexpires_a...
分类:
其他好文 时间:
2015-04-27 23:33:37
阅读次数:
153
同步Timerasio中提供的timer名为deadline_timer,它提供了超时计时的功能。首先以一个最简单的同步Timer为例来演示如何使用它。#include#includeintmain(){boost::asio::io_serviceio;boost::asio::deadline_...
分类:
其他好文 时间:
2015-04-27 23:27:47
阅读次数:
230
1. 官网下载最新的Boost库,我的是1.552.在使用vs2013编译boost-1.55.0之前,先要给boost做下修改:boost_1_55_0\boost\intrusive\detail\has_member_function_callable_with.hpp line:222tem...
分类:
其他好文 时间:
2015-04-27 21:30:24
阅读次数:
171
一哥们翻译的boost的无锁队列的官方文档原文地址:http://blog.csdn.net/great3779/article/details/8765103Boost_1_53_0终于迎来了久违的Boost.Lockfree模块,本着学习的心态,将其翻译如下。(原文地址:http://www.b...
分类:
其他好文 时间:
2015-04-25 16:36:13
阅读次数:
142
最近在学习Boost的智能指针,下面对一些很好的文章进行整理如下:Boost智能指针——scoped_ptrhttp://www.cnblogs.com/TianFang/archive/2008/09/15/1291050.htmlBoost智能指针——shared_ptrhttp://www.c...
分类:
其他好文 时间:
2015-04-25 13:23:54
阅读次数:
125
转自:http://blog.csdn.net/zhuky/archive/2010/03/10/5364574.aspxBoost.Asio是一个跨平台的网络及底层IO的C++编程库,它使用现代C++手法实现了统一的异步调用模型。头文件#include 名空间using namespace boo...
分类:
其他好文 时间:
2015-04-25 12:00:34
阅读次数:
103
利用boost来获取当前时间又方便快捷,还不用考虑跨平台的问题。1. 输出YYYYMMDD[cpp]view plaincopy#include#defineBOOST_DATE_TIME_SOURCEstd::stringstrTime=boost::gregorian::to_iso_strin...
分类:
其他好文 时间:
2015-04-25 10:32:13
阅读次数:
165
Christopher KohlhoffCopyright © 2003-2012 Christopher M. Kohlhoff以Boost1.0的软件授权进行发布(见附带的LICENSE_1_0.txt文件或从http://www.boost.org/LICENSE_1_0.txt)Boost....
分类:
其他好文 时间:
2015-04-24 12:29:08
阅读次数:
133