MCPcopy Create free account
hub / github.com/baidu/babylon / main

Function main

example/depend-use-workspace/example.cpp:7–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <vector>
6
7int 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}

Callers

nothing calls this directly

Calls 5

get_futureMethod · 0.80
emplace_backMethod · 0.80
count_downMethod · 0.80
getMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected