Lv.的博客
上一页 1 ··· 129 130 131 132 133 134 135 136 137 ··· 190 下一页
摘要: 前面创建的UDP服务器和客户端,都是同步的方式,也就是说当接收数据时,不能参与别的事情执行的。如果在一个只有界面线程的程序里,又不想创建多线程,导致复杂程度的增加,在这种情况之下,我们还有一个方案可以选择,就是创建一个异步的UDP服务器或客户端,这样既有单线程的简单性,也可以让客户随便操作界面的快速... 阅读全文
posted @ 2015-04-24 11:43 Avatarx 阅读(988) 评论(0) 推荐(0)
摘要: Christopher KohlhoffCopyright © 2003-2012 Christopher M. Kohlhoff以Boost1.0的软件授权进行发布(见附带的LICENSE_1_0.txt文件或从http://www.boost.org/LICENSE_1_0.txt)Boost.... 阅读全文
posted @ 2015-04-24 11:39 Avatarx 阅读(446) 评论(0) 推荐(0)
摘要: 初始化临界区(win)InitializeCriticalSection(RTL_CRITICAL_SECTION &rtl_critial_section) (linux)pthread_mutexattr_init(&(mutex)->attr);pthread_mutexattr_sett... 阅读全文
posted @ 2015-04-24 00:35 Avatarx 阅读(4233) 评论(0) 推荐(0)
摘要: /*Andyisgoingtoholdaconcertwhilethetimeisnotdecided.EricisafansofAndywhodoesn'twanttomissthisconcert.Andydoesn'tknowEric.HowcanEricgetsthenewswhenAndy... 阅读全文
posted @ 2015-04-23 22:49 Avatarx 阅读(663) 评论(0) 推荐(0)
摘要: 1) 观察者模式定义略,各种设计模式的书上都有定义。2) 观察者模式一般实现观察者模式一般实现,都是“被观察者”保存一个“观察者”的列表,循环这个列表来通知“观察者”。代码,其中使用了boost的智能指针shared_ptr:[cpp]view plaincopy#include#include#i... 阅读全文
posted @ 2015-04-23 22:46 Avatarx 阅读(519) 评论(0) 推荐(0)
摘要: http://blog.csdn.net/iamnieo/article/details/29086212008-09-10 12:489202人阅读评论(3)收藏举报thread多线程listlibrary存储io目录(?)[+] C++多线程开发是一个复杂的事情,mfc下提供了CWinThre... 阅读全文
posted @ 2015-04-22 16:07 Avatarx 阅读(423) 评论(0) 推荐(0)
摘要: 本文假设读者已经基本了解boost线程库的使用方法。boost是个开源工程,线程这一块也在不断完善之中,到现在这个阶段,boost::thread仅仅实现了一个完美的技术框架,但是读者在实际使用中会发现一些新的技术问题:1.boost::thread::join开启一个线程以后,怎样主动结束子线程?... 阅读全文
posted @ 2015-04-22 16:06 Avatarx 阅读(1002) 评论(0) 推荐(0)
摘要: //controlled_module_ex.hpp:controlled_module类的扩展//增强线程之间消息通讯//增加线程安全启动和安全关闭功能//增加定时器功能#pragmaonce#include#include#include"controlled_module.hpp"struct... 阅读全文
posted @ 2015-04-22 16:05 Avatarx 阅读(1617) 评论(0) 推荐(0)
摘要: 扩展threadtimermoduleexceptionsocket什么叫事务线程举个例子:我们写一个IM客户端的登录子线程,则该子线程会有这么几个事务要处理No.1 TCP Socket物理连接No.2 逻辑登录No.3 好友在线查询No.4 状态更新我们通常的代码写法是voidThreadLog... 阅读全文
posted @ 2015-04-22 16:04 Avatarx 阅读(413) 评论(0) 推荐(0)
摘要: modulethread扩展多线程破解通讯全文介绍了3个boost::thread的扩展类,希望能给大家书写多线程代码带来便捷。 thread -> controlled_module_ex ->controlled_module 那么我们具体在什么情况下选用不同的扩展类呢?1.如果你只想创建一个生... 阅读全文
posted @ 2015-04-22 16:03 Avatarx 阅读(375) 评论(0) 推荐(0)
上一页 1 ··· 129 130 131 132 133 134 135 136 137 ··· 190 下一页