Skip to content
/ lumino Public
forked from chenshuo/muduo

Lumino (Luminous Muduo) is an enhanced fork of the muduo library.

License

Notifications You must be signed in to change notification settings

edr1412/lumino

 
 

Repository files navigation

Original repository:

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.

这是是一个学习性项目,参考陈硕老师的muduo库,结合自己的理解,主要做了以下几点改动:
1. 完全去除了boost库的依赖,使用C++11/14/17的特性替代,并尽量使用 modern C++ 的语法
2. 使用标准库重写了Mutex、Condition、Thread的包装,简化了Singleton、ThreadLocalSingleton 的实现,移除了Atomic、ThreadLocal类
3. 用std::thread替换了pthread,但保留使用gettid(2)系统调用获取线程id的方式
4. 将线程池分离为 ThreadPool 和 SyncQueue,使逻辑清晰;为任务队列提供一种无锁的实现,在GitHub Codespace(2-core) 下测试,较 blocking-queue 提高性能159%
5. 验证实现了一些FIXME提到的细节,比如 TcpConnection 中使用CAS操作StateE状态,避免了潜在的竞争条件;并且增加send()的右值引用版本,避免了不必要的拷贝
6. 结合书中的内容,增加了一些注释

Tested on:
  Unbuntu 22.04 LTS

Optional dependencies:
  libprotobuf-dev protobuf-compiler (for Protobuf)

To build, run:

```sh
# ln -sf build/compile_commands.json
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release .. # if you want debug mode, use cmake .. instead
make
sudo make install # optional, will install to /usr/local
```

To run all the unit tests, run:

```sh
cd build
CTEST_OUTPUT_ON_FAILURE=TRUE make test
```

To uninstall, run:

```sh
sudo ./uninstall.sh
```

About

Lumino (Luminous Muduo) is an enhanced fork of the muduo library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 95.3%
  • CMake 3.5%
  • Other 1.2%