added a parallel execution
This commit is contained in:
parent
52196ddd44
commit
dca5b8eef1
3 changed files with 89 additions and 48 deletions
105
.clang-format
105
.clang-format
|
@ -1,39 +1,68 @@
|
|||
---
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: 'true'
|
||||
AlignEscapedNewlines: Right
|
||||
AlignTrailingComments: 'true'
|
||||
AllowShortFunctionsOnASingleLine: 'true'
|
||||
AllowShortBlocksOnASingleLine: 'true'
|
||||
AlwaysBreakTemplateDeclarations: 'true'
|
||||
AccessModifierOffset: -4
|
||||
BinPackArguments: 'false'
|
||||
BinPackParameters: 'false'
|
||||
BreakBeforeBraces: Mozilla
|
||||
BreakBeforeInheritanceComma: 'true'
|
||||
BreakBeforeTernaryOperators: 'true'
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakStringLiterals: 'true'
|
||||
ColumnLimit: '80'
|
||||
CompactNamespaces: 'false'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
|
||||
FixNamespaceComments: 'true'
|
||||
ForEachMacros: ['IMMER_CATCH', 'IMMER_TRY']
|
||||
IndentCaseLabels: 'false'
|
||||
IndentWidth: '4'
|
||||
IndentWrappedFunctionNames: 'false'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'false'
|
||||
BasedOnStyle: Mozilla
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: '1'
|
||||
NamespaceIndentation: None
|
||||
PointerAlignment: Left
|
||||
ReflowComments: 'true'
|
||||
SortIncludes: 'true'
|
||||
SortUsingDeclarations: 'true'
|
||||
SpaceAfterCStyleCast: 'true'
|
||||
SpaceAfterTemplateKeyword: 'true'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
TabWidth: '4'
|
||||
UseTab: Never
|
||||
...
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: true
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
ColumnLimit: 80
|
||||
ContinuationIndentWidth: 2
|
||||
Cpp11BracedListStyle: true
|
||||
FixNamespaceComments: true
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
# Seastar files (with angles)
|
||||
- Regex: '^<seastar/'
|
||||
Priority: 2
|
||||
# Other libraries
|
||||
- Regex: '^<.+/'
|
||||
Priority: 4
|
||||
# Std header files (with angles)
|
||||
- Regex: '^<'
|
||||
Priority: 5
|
||||
# Internal headers (with quotes)
|
||||
- Regex: '.h'
|
||||
Priority: 1
|
||||
IndentCaseLabels: false
|
||||
IndentRequires: false
|
||||
IndentRequiresClause: false
|
||||
IndentWidth: 4
|
||||
InsertNewlineAtEOF: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
PenaltyBreakAssignment: 80
|
||||
PenaltyBreakBeforeFirstCallParameter: 10
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
RequiresClausePosition: OwnLine
|
||||
RequiresExpressionIndentation: OuterScope
|
||||
---
|
||||
Language: JavaScript
|
||||
# Use 100 columns for JS.
|
||||
ColumnLimit: 80
|
||||
---
|
||||
Language: Java
|
||||
ColumnLimit: 80
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: true
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Attach
|
||||
---
|
||||
Language: Proto
|
||||
BasedOnStyle: Google
|
||||
ColumnLimit: 80
|
||||
IndentWidth: 4
|
||||
|
|
1
compile_commands.json
Symbolic link
1
compile_commands.json
Symbolic link
|
@ -0,0 +1 @@
|
|||
build/compile_commands.json
|
23
src/noidb.cc
23
src/noidb.cc
|
@ -2,13 +2,23 @@
|
|||
#include <seastar/core/coroutine.hh>
|
||||
#include <seastar/util/log.hh>
|
||||
|
||||
//using namespace seastar;
|
||||
// using namespace seastar;
|
||||
|
||||
seastar::logger lg("hanoidb");
|
||||
|
||||
static seastar:future<> hello_from_all_cores() {
|
||||
co_await seastar:smp::invoke_on_all([]() -> seastar::future<> {
|
||||
lg.info("Hello from every core");
|
||||
static seastar::future<> hello_from_all_cores_serial() {
|
||||
for (unsigned i = 0; i < seastar::smp::count; ++i) {
|
||||
co_await seastar::smp::submit_to(
|
||||
i, [] { lg.info("serial - Hello from every core"); });
|
||||
};
|
||||
co_return;
|
||||
}
|
||||
|
||||
static seastar::future<> hello_from_all_cores_parallel() {
|
||||
co_await seastar::smp::invoke_on_all(
|
||||
[]() -> seastar::future<> {
|
||||
lg.info("parallel - Hello from every core");
|
||||
co_return;
|
||||
});
|
||||
co_return;
|
||||
}
|
||||
|
@ -16,8 +26,9 @@ static seastar:future<> hello_from_all_cores() {
|
|||
int main(int argc, char** argv) {
|
||||
seastar::app_template app;
|
||||
|
||||
return app.run(argc, argv, [&] () -> seastar::future<int> {
|
||||
co_await hello_from_all_cores();
|
||||
return app.run(argc, argv, [&]() -> seastar::future<int> {
|
||||
co_await hello_from_all_cores_serial();
|
||||
co_await hello_from_all_cores_parallel();
|
||||
co_return 0;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue