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 @@
|
||||||
---
|
BasedOnStyle: Mozilla
|
||||||
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'
|
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
MaxEmptyLinesToKeep: '1'
|
AccessModifierOffset: -4
|
||||||
NamespaceIndentation: None
|
AlignAfterOpenBracket: AlwaysBreak
|
||||||
PointerAlignment: Left
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
ReflowComments: 'true'
|
AllowShortBlocksOnASingleLine: false
|
||||||
SortIncludes: 'true'
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
SortUsingDeclarations: 'true'
|
AllowShortFunctionsOnASingleLine: true
|
||||||
SpaceAfterCStyleCast: 'true'
|
AllowShortIfStatementsOnASingleLine: true
|
||||||
SpaceAfterTemplateKeyword: 'true'
|
AllowShortLoopsOnASingleLine: false
|
||||||
SpaceBeforeAssignmentOperators: 'true'
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
SpaceBeforeParens: ControlStatements
|
AlwaysBreakAfterReturnType: None
|
||||||
TabWidth: '4'
|
BreakBeforeBinaryOperators: All
|
||||||
UseTab: Never
|
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
|
31
src/noidb.cc
31
src/noidb.cc
|
@ -2,22 +2,33 @@
|
||||||
#include <seastar/core/coroutine.hh>
|
#include <seastar/core/coroutine.hh>
|
||||||
#include <seastar/util/log.hh>
|
#include <seastar/util/log.hh>
|
||||||
|
|
||||||
//using namespace seastar;
|
// using namespace seastar;
|
||||||
|
|
||||||
seastar::logger lg("hanoidb");
|
seastar::logger lg("hanoidb");
|
||||||
|
|
||||||
static seastar:future<> hello_from_all_cores() {
|
static seastar::future<> hello_from_all_cores_serial() {
|
||||||
co_await seastar:smp::invoke_on_all([]() -> seastar::future<> {
|
for (unsigned i = 0; i < seastar::smp::count; ++i) {
|
||||||
lg.info("Hello from every core");
|
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;
|
co_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
seastar::app_template app;
|
seastar::app_template app;
|
||||||
|
|
||||||
return app.run(argc, argv, [&] () -> seastar::future<int> {
|
return app.run(argc, argv, [&]() -> seastar::future<int> {
|
||||||
co_await hello_from_all_cores();
|
co_await hello_from_all_cores_serial();
|
||||||
co_return 0;
|
co_await hello_from_all_cores_parallel();
|
||||||
});
|
co_return 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue