11 2018 档案

摘要:多线程同步回调#include #include #include #include #include #include using namespace boost; using namespace std; class CPrinter { public: CPrinter(boost::asio::io_service &io) :m_strand(... 阅读全文
posted @ 2018-11-28 23:46 osbreak 阅读(236) 评论(0) 推荐(0) 编辑
摘要:同步定时器 #include #include #include #include int main() { boost::asio::io_service io; boost::asio::deadline_timer t(io, boost::posix_time::seconds(5)); t.wait();//同步定时器,5后被调用 std::cout #incl... 阅读全文
posted @ 2018-11-27 22:11 osbreak 阅读(422) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include #include #include #include #include #include #include #include #define BUF_SIZE 1024 void aio_completion_handler(sigval_t s... 阅读全文
posted @ 2018-11-19 23:19 osbreak 阅读(475) 评论(0) 推荐(0) 编辑
摘要:#include /* 函数名 :int aio_write(struct aiocb *aiocbp) 参 数 :struct aiocb *aiocbp 返回值 :执行成功返回0,出错返回-1,并设置errno的值 说 明 :请求对一个有效的文件描述符进行异步读操作, 这个文件描述符可以表示一个文件、套接字甚至管道 */ int aio_write(... 阅读全文
posted @ 2018-11-19 23:10 osbreak 阅读(254) 评论(0) 推荐(0) 编辑
摘要:理解 epoll 过程 阅读全文
posted @ 2018-11-19 23:05 osbreak 阅读(296) 评论(0) 推荐(0) 编辑
摘要:epoll 是 Linux 内核为处理大批量文件描述符而作了改进的 poll,是 Linux 下多路复用 IO接口 select/poll 的增强版本 在 linux 的网络编程中,很长时间都在使用 select 来做事件触发。在 2.6 内核中,有一种替换它的机制,就是 epoll。 select 与 epoll 区别概述 1、函数使用上:epoll 使用一组函数来完成任务,而不... 阅读全文
posted @ 2018-11-18 21:10 osbreak 阅读(613) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> #include<sys/socket.h> #include<netinet/in.h> #include<arpa/inet.h> #includ 阅读全文
posted @ 2018-11-18 21:09 osbreak 阅读(165) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> #include<sys/socket.h> #include<netinet/in.h> #include<arpa/inet.h> #includ 阅读全文
posted @ 2018-11-18 21:09 osbreak 阅读(190) 评论(0) 推荐(0) 编辑
摘要:阻塞 阻塞调用是指调用结果返回之前,当前线程会被挂起(线程进入非可执行状态,在这个状态下,cpu不会给线程分配时间片,即线程暂停运行)。 函数只有在得到结果之后才会返回。 非阻塞 非阻塞和阻塞的概念相对应,指在不能立刻得到结果之前,该函数不会阻塞当前线程,而会立刻返回。 /**参 数 :int nf 阅读全文
posted @ 2018-11-14 23:24 osbreak 阅读(1330) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2018-11-08 14:40 osbreak 阅读(861) 评论(0) 推荐(0) 编辑
摘要:定义业务类,继承 Thread类,实现run函数。调用start()即可 #pragma once #include <windows.h> class Thread { public: DWORD _threadId; HANDLE _thread; protected: /** * 线程入口函数 阅读全文
posted @ 2018-11-06 11:34 osbreak 阅读(178) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示