muduo README

The project's README from github.com/chenshuo/muduo. As one markdown file: README.md.

Muduo is a multithreaded C++ network library based on the reactor pattern.

http://github.com/chenshuo/muduo

Copyright (c) 2010, Shuo Chen. All rights reserved.

Use of this source code is governed by a BSD-style license that can be found in the License file.

Requires: Linux kernel version >= 2.6.28. GCC >= 4.7 or Clang >= 3.5 Boost (for boost::any only.)

Tested on: Debian 7 and above Unbuntu 14.04 and above CentOS 7 and above

Install required packages:

Debian, Ubuntu, etc.

$ sudo apt install g++ cmake make libboost-dev

CentOS

$ sudo yum install gcc-c++ cmake make boost-devel

See .travis.yml for additional packages for building more examples.

To build, run: ./build.sh

See https://github.com/chenshuo/muduo-tutorial for how to use muduo in your project.


| / | | | | \ / |_ _ | |_ _ ___ | |/| | | | |/ ` | | | |/ _
| | | | |
| | (| | || | () | || ||_,|_,|_,_|_
/

muduo (chenshuo/muduo)

Searching Database…

16.3K ·GitHub
这是什么?Muduo 是一个基于 Reactor 模式的多线程 C++ 网络库,用于在 Linux 上编写高性能、事件驱动的服务器。
这是独立的服务器程序,还是我要在上面开发的库?它是一个 C++ 库,你需要把它链接到自己的项目中。你在它提供的 Reactor 和事件循环基础组件之上编写服务器逻辑,而不是把 muduo 当作独立应用来运行。
我该怎么编译它?先为你的发行版安装所需的软件包,然后在仓库根目录下运行 ./build.sh,即可编译库和示例程序。
我得先装什么?需要一台 Linux 机器,装有 GCC 4.7+ 或 Clang 3.5+,以及 cmake、make 和 Boost(Boost 仅用于 boost::any)。在 Debian/Ubuntu 上安装 'g++ cmake make libboost-dev';在 CentOS 上安装 'gcc-c++ cmake make boost-devel'。
它能在所有操作系统上运行,还是只能在 Linux 上?Muduo 仅支持 Linux,且需要内核 2.6.28 或更高版本。它不支持 Windows 或 macOS,因为它依赖 epoll 等 Linux 专有接口。
muduo 所基于的 Reactor 模式是什么?单个线程通过 epoll 等待多个套接字事件,然后分发回调。muduo 的做法是为每个线程配备一个事件循环,因此多线程服务器可以充分利用多个 CPU 核心,而无需为每个连接分配一个线程。
它实际在哪些发行版上测试过?README 列出的测试平台包括 Debian 7 及以上、Ubuntu 14.04 及以上,以及 CentOS 7 及以上。
仓库里有可以直接运行的示例吗?有,仓库自带示例服务器和客户端。要编译全部示例,需要安装项目 .travis.yml 中列出的额外软件包。
Creator
chenshuo
Size
1.8 MB
Stars
16.3K
Age
16y
Commits · 90 Days