CppCoro 项目教程
1. 项目的目录结构及介绍
CppCoro 项目的目录结构如下:
cppcoro/
├── include/
│ └── cppcoro/
│ ├── async_generator.hpp
│ ├── async_mutex.hpp
│ ├── async_auto_reset_event.hpp
│ ├── async_manual_reset_event.hpp
│ ├── async_latch.hpp
│ ├── cancellation_token.hpp
│ ├── cancellation_source.hpp
│ ├── cancellation_registration.hpp
│ ├── config.hpp
│ ├── details/
│ ├── event.hpp
│ ├── file.hpp
│ ├── io_service.hpp
│ ├── io_work_scope.hpp
│ ├── io_work_token.hpp
│ ├── lazy.hpp
│ ├── net/
│ ├── recursive_async_mutex.hpp
│ ├── single_consumer_event.hpp
│ ├── single_consumer_queue.hpp
│ ├── sync_wait.hpp
│ ├── task.hpp
│ ├── when_all.hpp
│ ├── when_all_ready.hpp
│ ├── when_any.hpp
│ └── when_each.hpp
├── src/
│ ├── async_generator.cpp
│ ├── async_mutex.cpp
│ ├── async_auto_reset_event.cpp
│ ├── async_manual_reset_event.cpp
│ ├── async_latch.cpp
│ ├── cancellation_token.cpp
│ ├── cancellation_source.cpp
│ ├── cancellation_registration.cpp
│ ├── config.cpp
│ ├── details/
│ ├── event.cpp
│ ├── file.cpp
│ ├── io_service.cpp
│ ├── io_work_scope.cpp
│ ├── io_work_token.cpp
│ ├── lazy.cpp
│ ├── net/
│ ├── recursive_async_mutex.cpp
│ ├── single_consumer_event.cpp
│ ├── single_consumer_queue.cpp
│ ├── sync_wait.cpp
│ ├── task.cpp
│ ├── when_all.cpp
│ ├── when_all_ready.cpp
│ ├── when_any.cpp
│ └── when_each.cpp
├── test/
│ ├── async_generator_tests.cpp
│ ├── async_mutex_tests.cpp
│ ├── async_auto_reset_event_tests.cpp
│ ├── async_manual_reset_event_tests.cpp
│ ├── async_latch_tests.cpp
│ ├── cancellation_token_tests.cpp
│ ├── cancellation_source_tests.cpp
│ ├── cancellation_registration_tests.cpp
│ ├── config_tests.cpp
│ ├── details/
│ ├── event_tests.cpp
│ ├── file_tests.cpp
│ ├── io_service_tests.cpp
│ ├── io_work_scope_tests.cpp
│ ├── io_work_token_tests.cpp
│ ├── lazy_tests.cpp
│ ├── net/
│ ├── recursive_async_mutex_tests.cpp
│ ├── single_consumer_event_tests.cpp
│ ├── single_consumer_queue_tests.cpp
│ ├── sync_wait_tests.cpp
│ ├── task_tests.cpp
│ ├── when_all_tests.cpp
│ ├── when_all_ready_tests.cpp
│ ├── when_any_tests.cpp
│ └── when_each_tests.cpp
├── .gitignore
├── CMakeLists.txt
├── LICENSE
└── README.md
目录结构介绍
include/cppcoro/
: 包含所有头文件,定义了各种协程相关的类和函数。src/
: 包含所有源文件,实现了头文件中定义的功能。test/
: 包含所有测试文件,用于测试各个功能模块。.gitignore
: Git 忽略文件配置。CMakeLists.txt
: CMake 构建配置文件。LICENSE
: 项目许可证文件。README.md
: 项目说明文档。
2. 项目的启动文件介绍
CppCoro 项目的启动文件通常是 main.cpp
或 main.cc
,但该项目没有提供具体的启动文件示例。通常,启动文件会包含以下内容: