| 90 | |
| 91 | |
| 92 | void example_http_server() { |
| 93 | GPipelineManager manager; |
| 94 | const int times = 3; |
| 95 | for (int i = 0; i < times; i++) { |
| 96 | auto pipeline = build_pipeline(); |
| 97 | manager.add(pipeline); // 在manger中,加入3个pipeline信息 |
| 98 | } |
| 99 | auto status = manager.init(); // 初始化 manager 中所有的pipeline信息 |
| 100 | |
| 101 | std::vector<std::thread> thds; |
| 102 | for (int i = 0; i < times; i++) { |
| 103 | auto thd = std::thread([&] { |
| 104 | mock_client_request(manager); |
| 105 | }); |
| 106 | thds.emplace_back(std::move(thd)); |
| 107 | } |
| 108 | |
| 109 | for (int i = 0; i < times; i++) { |
| 110 | thds[i].join(); |
| 111 | } |
| 112 | |
| 113 | manager.destroy(); |
| 114 | GPipelineFactory::clear(); // 这里析构所有的pipeline信息 |
| 115 | } |
| 116 | |
| 117 | |
| 118 | int main() { |
no test coverage detected