下载新的https://www.boost.org/https://www.boost.org/build/doc/html/bbv2/installation.html
原创
2024-03-04 15:44:40
23阅读
一、简介Muduo(木铎)是基于 Reactor 模式的网络库。二、安装从github库下载源码安装:https://github.com/chenshuo/muduomuduo依赖了很多的库,所以在安装muduo之前应该安装这些库,包括:curl、c-ares、protobuf。前面两个在cent...
转载
2015-10-18 18:18:00
469阅读
2评论
一、由来2010年3月我写了一篇《学之者生,用之者死——ACE历史与简 评》1,其中提到“我心目中理想的网络库”的样子: ·线程安全,原生支持多核多线程。 ·不考虑可移植性,不跨平台,只支持Linux,不支持Windows。 ·主要支持x86-64,兼顾IA32。(实际上muduo也可以运行在ARM 上。) ·不支持UDP,只支持TCP。 ·不支持IPv6,只支持IPv4。 ·不考虑广域网应...
原创
2021-08-28 13:10:04
2646阅读
一、由来2010年3月我写了一篇《学之者生,用之者死——ACE历史与简 评》1,其中提到“我心目中理想的网络库”的样子: ·线程安全,原生支持多核多线程。 ·不考虑可移植性,不跨平台,只支持Linux,不支持Windows。 ·主要支持x86-,兼顾IA32。(实际上muduo也可以运行在ARM 上。) ·不支持UDP,只支持TCP。 ·不支持IPv6,只支持IPv4。 ·不考虑广域网应...
原创
2022-02-10 10:45:57
6080阅读
首先是添加注释的源码: // Use of this source code is governed by a BSD-style license // that can be found in the License file. // // Author: Shuo Chen (chenshuo
原创
2021-03-17 15:58:00
92阅读
首先
原创
2022-09-21 15:42:53
88阅读
一、安装依赖库# 安装cmakesudo apt-get install cmake # 安装boostsudo apt-get install libboost-dev libboost-test-dev# 三个非必
原创
2023-08-30 14:39:12
287阅读
总结说的有的过大,算是对自己学习的一个总结。兴许会不断补充。
模型总结
muduo是基于非堵塞的IO和事件驱动的网络库。 muduo的总体结构时one loop per thread+threadpool,图例如以下: mainReactor和subReactor都是EventLoop,在mainReactor中接收连接。把建立后的连接分发到subReactor中。
作者開始在muduo
转载
2017-06-27 10:15:00
278阅读
2评论
muduo的线程模型为one loop per thread+thread pool模型,在前面一篇文章的末尾曾简单的提起过:https://blog..net/qq_41453285/article/details/105104845
原创
2022-01-15 16:50:17
472阅读
muduo的线程模型为one loop per thread+thread pool模型,在前面一篇文章的末尾曾简单的提起过:https://blog.csdn.net/qq_41453285/article/details/105104845 本节以一个Sudoku Solver(数独求解)例子为例,回顾了并发网络服务程序的多种设计方案,并介绍了使用muduo网络库编写多线程服务器的两种最常用手法 在后面“muduo编程示例”相关文章会展现muduo在编写单线程并发网络服务程序方面的能力与便捷性。本文
原创
2021-08-28 15:55:15
538阅读
首先再GitHub找到muduo,查看clone的链接,使用git命令clone到本地: git clone https://github.com/chenshuo/muduo.git muduo现在有1.0和2.0两个版本可选,1.0版本编译前需要下载boost,2.0不需要 安装boost: y
原创
2022-09-21 15:43:00
284阅读
channel是muduo中的事件分发器,它只属于一个EventLoop,Channel类中保存着IO事件的类型以及对应的回调函数,每个channel只负责一个文件描述符,但它并不拥有这个文件描述符。channel是在epoll和TcpConnection之间起沟通作用,故也叫做通道,其它类通过调用channel的setCallbcak来和建立channel沟通关系。Chan...
原创
2021-06-01 13:13:38
387阅读
看一下muduo实现的epoll// Copyright 2010, Shuo Chen. All rights reserved.// http://code.google.com/p/muduo///// Use of this source code is governed by a BSD-style license// that can be found...
原创
2021-06-01 13:13:39
222阅读
EventLoop.cc就相当于一个reactor,多线程之间的函数调用(用eventfd唤醒),epoll处理,超时队列处理,对channel的处理。运行loop的进程被称为IO线程,EventLoop提供了一些API确保相应函数在IO线程中调用,确保没有用互斥量保护的变量只能在IO线程中使用,也封装了超时队列的基本操作。EventLoop.h// Copyright...
原创
2021-06-01 13:13:42
332阅读
Atomic是muduo原子操作的实现类。Atomic.h// Use of this source code is governed by a BSD-style license// that can be found in the License file.//// Author: Shuo Chen (chenshuo at chenshuo dot com...
原创
2021-06-01 13:13:58
260阅读
GzipFile封装了gzip的一些API,记录一下// Use of this source code is governed by a BSD-style license// that can be found in the License file.//// Author: Shuo Chen (chenshuo at chenshuo dot com)#pr...
原创
2021-06-01 13:14:05
622阅读
Connector负责主动发起连接,不负责创建socket,只负责连接的建立,外部调用Connector::start就可以发起连接,Connector具有重连的功能和停止连接的功能,连接成功建立后返回到TcpClient。Connector.h// Copyright 2010, Shuo Chen. All rights reserved.// http://...
原创
2021-06-01 13:14:12
437阅读
Acceptor类用于创建套接字,设置套接字选项,调用listen函数,接受连接,然后调用TcpServer的回调。// Copyright 2010, Shuo Chen. All rights reserved.// http://code.google.com/p/muduo///// Use of this source code is governed b...
原创
2021-06-01 13:13:41
253阅读
LogStream.h// Use of this source code is governed by a BSD-style license// that can be found in the License file.//// Author: Shuo Chen (chenshuo at chenshuo dot com)#ifndef MUDUO_BAS...
原创
2021-06-01 13:13:56
395阅读
muduo中的单例模式Singleton.h// Use of this source code is governed by a BSD-style license// that can be found in the License file.//// Author: Shuo Chen (chenshuo at chenshuo dot com)#ifn...
原创
2021-06-01 13:13:59
377阅读