| 5 | #include <vector> |
| 6 | |
| 7 | int main() { |
| 8 | ::babylon::CountDownLatch<> latch(10); |
| 9 | auto future = latch.get_future(); |
| 10 | ::std::vector<::std::thread> threads; |
| 11 | for (size_t i = 0; i < 10; ++i) { |
| 12 | threads.emplace_back([&, i]() { |
| 13 | BABYLON_LOG(INFO) << "finish " << i; |
| 14 | latch.count_down(); |
| 15 | }); |
| 16 | } |
| 17 | future.get(); |
| 18 | BABYLON_LOG(INFO) << "finish all"; |
| 19 | for (auto& thread : threads) { |
| 20 | thread.join(); |
| 21 | } |
| 22 | return 0; |
| 23 | } |
nothing calls this directly
no test coverage detected