-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
254 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BAZELISK_BASE_URL=https://github.com/bazelbuild/bazel/releases/download | ||
USE_BAZEL_VERSION=7.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
common --registry=https://baidu.github.io/babylon/registry | ||
common --registry=https://raw.githubusercontent.com/bazelboost/registry/main | ||
common --registry=https://bcr.bazel.build | ||
|
||
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cc_binary( | ||
name = 'example', | ||
srcs = ['example.cpp'], | ||
deps = [ | ||
'@babylon//:future', | ||
'@babylon//:logging', | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bazel_dep(name = 'babylon', version = '1.1.4') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
set -ex | ||
|
||
bazel build example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "babylon/future.h" | ||
#include "babylon/logging/interface.h" | ||
|
||
#include <thread> | ||
#include <vector> | ||
|
||
int main() { | ||
::babylon::CountDownLatch<> latch(10); | ||
auto future = latch.get_future(); | ||
::std::vector<::std::thread> threads; | ||
for (size_t i = 0; i < 10; ++i) { | ||
threads.emplace_back([&, i] () { | ||
BABYLON_LOG(INFO) << "finish " << i; | ||
latch.count_down(); | ||
}); | ||
} | ||
future.get(); | ||
BABYLON_LOG(INFO) << "finish all"; | ||
for (auto& thread : threads) { | ||
thread.join(); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
set(BUILD_DEPS ON) | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
babylon | ||
URL "https://github.com/baidu/babylon/archive/refs/tags/v1.1.4.tar.gz" | ||
URL_HASH SHA256=2e7efea3f0a8aeffc03f908ff2875a82eb5a94cd1de3e591b6dc388f7a992411 | ||
) | ||
FetchContent_MakeAvailable(babylon) | ||
|
||
add_executable(example example.cpp) | ||
target_link_libraries(example babylon::babylon) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
set -ex | ||
|
||
cmake -Bbuild | ||
cmake --build build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "babylon/future.h" | ||
#include "babylon/logging/interface.h" | ||
|
||
#include <thread> | ||
#include <vector> | ||
|
||
int main() { | ||
::babylon::CountDownLatch<> latch(10); | ||
auto future = latch.get_future(); | ||
::std::vector<::std::thread> threads; | ||
for (size_t i = 0; i < 10; ++i) { | ||
threads.emplace_back([&, i] () { | ||
BABYLON_LOG(INFO) << "finish " << i; | ||
latch.count_down(); | ||
}); | ||
} | ||
future.get(); | ||
BABYLON_LOG(INFO) << "finish all"; | ||
for (auto& thread : threads) { | ||
thread.join(); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
find_package(babylon REQUIRED) | ||
|
||
add_executable(example example.cpp) | ||
target_link_libraries(example babylon::babylon) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
set -ex | ||
|
||
cmake -Bbuild | ||
cmake --build build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "babylon/future.h" | ||
#include "babylon/logging/interface.h" | ||
|
||
#include <thread> | ||
#include <vector> | ||
|
||
int main() { | ||
::babylon::CountDownLatch<> latch(10); | ||
auto future = latch.get_future(); | ||
::std::vector<::std::thread> threads; | ||
for (size_t i = 0; i < 10; ++i) { | ||
threads.emplace_back([&, i] () { | ||
BABYLON_LOG(INFO) << "finish " << i; | ||
latch.count_down(); | ||
}); | ||
} | ||
future.get(); | ||
BABYLON_LOG(INFO) << "finish all"; | ||
for (auto& thread : threads) { | ||
thread.join(); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
set(BOOST_INCLUDE_LIBRARIES preprocessor spirit) | ||
add_subdirectory(boost EXCLUDE_FROM_ALL) | ||
set(ABSL_ENABLE_INSTALL ON) | ||
add_subdirectory(abseil-cpp) | ||
set(protobuf_BUILD_TESTS OFF) | ||
add_subdirectory(protobuf) | ||
add_subdirectory(babylon) | ||
|
||
add_executable(example example.cpp) | ||
target_link_libraries(example babylon::babylon) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
set -ex | ||
|
||
cmake -Bbuild | ||
cmake --build build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "babylon/future.h" | ||
#include "babylon/logging/interface.h" | ||
|
||
#include <thread> | ||
#include <vector> | ||
|
||
int main() { | ||
::babylon::CountDownLatch<> latch(10); | ||
auto future = latch.get_future(); | ||
::std::vector<::std::thread> threads; | ||
for (size_t i = 0; i < 10; ++i) { | ||
threads.emplace_back([&, i] () { | ||
BABYLON_LOG(INFO) << "finish " << i; | ||
latch.count_down(); | ||
}); | ||
} | ||
future.get(); | ||
BABYLON_LOG(INFO) << "finish all"; | ||
for (auto& thread : threads) { | ||
thread.join(); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"url": "https://github.com/baidu/babylon/archive/refs/tags/v1.1.4.tar.gz", | ||
"strip_prefix": "babylon-1.1.4", | ||
"integrity": "sha256-Okm+CB5XgGPs+p3y3yLjCbFO2GFth/o5d2wgHh2DlJQ=" | ||
"integrity": "sha256-Ln7+o/Corv/AP5CP8odagutalM0d4+WRttw4j3qZJBE=" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters