aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/rain_check/core
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/messagebus/rain_check/core
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/rain_check/core')
-rw-r--r--library/cpp/messagebus/rain_check/core/coro.cpp14
-rw-r--r--library/cpp/messagebus/rain_check/core/coro.h16
-rw-r--r--library/cpp/messagebus/rain_check/core/coro_stack.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/coro_stack.h56
-rw-r--r--library/cpp/messagebus/rain_check/core/coro_ut.cpp8
-rw-r--r--library/cpp/messagebus/rain_check/core/env.h24
-rw-r--r--library/cpp/messagebus/rain_check/core/simple.cpp2
-rw-r--r--library/cpp/messagebus/rain_check/core/simple.h16
-rw-r--r--library/cpp/messagebus/rain_check/core/simple_ut.cpp6
-rw-r--r--library/cpp/messagebus/rain_check/core/sleep.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/sleep.h2
-rw-r--r--library/cpp/messagebus/rain_check/core/sleep_ut.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/spawn.cpp2
-rw-r--r--library/cpp/messagebus/rain_check/core/spawn.h2
-rw-r--r--library/cpp/messagebus/rain_check/core/spawn_ut.cpp24
-rw-r--r--library/cpp/messagebus/rain_check/core/task.cpp28
-rw-r--r--library/cpp/messagebus/rain_check/core/task.h82
-rw-r--r--library/cpp/messagebus/rain_check/core/track.cpp10
-rw-r--r--library/cpp/messagebus/rain_check/core/track.h32
-rw-r--r--library/cpp/messagebus/rain_check/core/track_ut.cpp8
20 files changed, 172 insertions, 172 deletions
diff --git a/library/cpp/messagebus/rain_check/core/coro.cpp b/library/cpp/messagebus/rain_check/core/coro.cpp
index 8dda6c9f97..500841dd5b 100644
--- a/library/cpp/messagebus/rain_check/core/coro.cpp
+++ b/library/cpp/messagebus/rain_check/core/coro.cpp
@@ -26,12 +26,12 @@ TCoroTaskRunner::~TCoroTaskRunner() {
Y_ASSERT(CoroDone);
}
-Y_POD_STATIC_THREAD(TContMachineContext*)
-CallerContext;
-Y_POD_STATIC_THREAD(TCoroTaskRunner*)
-Task;
+Y_POD_STATIC_THREAD(TContMachineContext*)
+CallerContext;
+Y_POD_STATIC_THREAD(TCoroTaskRunner*)
+Task;
-bool TCoroTaskRunner::ReplyReceived() {
+bool TCoroTaskRunner::ReplyReceived() {
Y_ASSERT(!CoroDone);
TContMachineContext me;
@@ -49,12 +49,12 @@ bool TCoroTaskRunner::ReplyReceived() {
return !CoroDone;
}
-void NRainCheck::TCoroTaskRunner::DoRun() {
+void NRainCheck::TCoroTaskRunner::DoRun() {
GetImpl()->Run();
CoroDone = true;
ContMachineContext.SwitchTo(CallerContext);
}
-void NRainCheck::ICoroTask::WaitForSubtasks() {
+void NRainCheck::ICoroTask::WaitForSubtasks() {
Task->ContMachineContext.SwitchTo(CallerContext);
}
diff --git a/library/cpp/messagebus/rain_check/core/coro.h b/library/cpp/messagebus/rain_check/core/coro.h
index c62bef5ebc..95e2a30f9b 100644
--- a/library/cpp/messagebus/rain_check/core/coro.h
+++ b/library/cpp/messagebus/rain_check/core/coro.h
@@ -14,7 +14,7 @@ namespace NRainCheck {
class TCoroTaskRunner: public TTaskRunnerBase, private ITrampoLine {
friend class ICoroTask;
-
+
private:
NPrivate::TCoroStack Stack;
TContMachineContext ContMachineContext;
@@ -31,9 +31,9 @@ namespace NRainCheck {
void DoRun() override /* override */;
- ICoroTask* GetImpl() {
- return (ICoroTask*)GetImplBase();
- }
+ ICoroTask* GetImpl() {
+ return (ICoroTask*)GetImplBase();
+ }
};
class ICoroTask: public ITaskBase {
@@ -46,10 +46,10 @@ namespace NRainCheck {
typedef TCoroTaskRunner TTaskRunner;
typedef ICoroTask ITask;
- ICoroTask(size_t stackSize = 0x2000)
- : StackSize(stackSize)
- {
- }
+ ICoroTask(size_t stackSize = 0x2000)
+ : StackSize(stackSize)
+ {
+ }
virtual void Run() = 0;
static void WaitForSubtasks();
diff --git a/library/cpp/messagebus/rain_check/core/coro_stack.cpp b/library/cpp/messagebus/rain_check/core/coro_stack.cpp
index be69939415..83b984ca6e 100644
--- a/library/cpp/messagebus/rain_check/core/coro_stack.cpp
+++ b/library/cpp/messagebus/rain_check/core/coro_stack.cpp
@@ -22,11 +22,11 @@ TCoroStack::TCoroStack(size_t size)
*MagicNumberLocation() = MAGIC_NUMBER;
#if defined(WITH_VALGRIND)
- ValgrindStackId = VALGRIND_STACK_REGISTER(Data(), (char*)Data() + Size());
+ ValgrindStackId = VALGRIND_STACK_REGISTER(Data(), (char*)Data() + Size());
#endif
}
-TCoroStack::~TCoroStack() {
+TCoroStack::~TCoroStack() {
#if defined(WITH_VALGRIND)
VALGRIND_STACK_DEREGISTER(ValgrindStackId);
#endif
diff --git a/library/cpp/messagebus/rain_check/core/coro_stack.h b/library/cpp/messagebus/rain_check/core/coro_stack.h
index 6d40da1ea1..2f3520e6e4 100644
--- a/library/cpp/messagebus/rain_check/core/coro_stack.h
+++ b/library/cpp/messagebus/rain_check/core/coro_stack.h
@@ -4,51 +4,51 @@
#include <util/generic/ptr.h>
#include <util/system/valgrind.h>
-namespace NRainCheck {
- namespace NPrivate {
- struct TCoroStack {
- THolder<void, TFree> DataHolder;
- size_t SizeValue;
+namespace NRainCheck {
+ namespace NPrivate {
+ struct TCoroStack {
+ THolder<void, TFree> DataHolder;
+ size_t SizeValue;
#if defined(WITH_VALGRIND)
- size_t ValgrindStackId;
+ size_t ValgrindStackId;
#endif
- TCoroStack(size_t size);
- ~TCoroStack();
+ TCoroStack(size_t size);
+ ~TCoroStack();
- void* Data() {
- return DataHolder.Get();
- }
+ void* Data() {
+ return DataHolder.Get();
+ }
- size_t Size() {
- return SizeValue;
- }
+ size_t Size() {
+ return SizeValue;
+ }
TArrayRef<char> MemRegion() {
return TArrayRef((char*)Data(), Size());
- }
+ }
- ui32* MagicNumberLocation() {
+ ui32* MagicNumberLocation() {
#if STACK_GROW_DOWN == 1
- return (ui32*)Data();
+ return (ui32*)Data();
#elif STACK_GROW_DOWN == 0
- return ((ui32*)(((char*)Data()) + Size())) - 1;
+ return ((ui32*)(((char*)Data()) + Size())) - 1;
#else
#error "unknown"
#endif
- }
+ }
- static void FailStackOverflow();
+ static void FailStackOverflow();
- inline void VerifyNoStackOverflow() noexcept {
- if (Y_UNLIKELY(*MagicNumberLocation() != MAGIC_NUMBER)) {
- FailStackOverflow();
- }
+ inline void VerifyNoStackOverflow() noexcept {
+ if (Y_UNLIKELY(*MagicNumberLocation() != MAGIC_NUMBER)) {
+ FailStackOverflow();
+ }
}
- static const ui32 MAGIC_NUMBER = 0xAB4D15FE;
- };
+ static const ui32 MAGIC_NUMBER = 0xAB4D15FE;
+ };
- }
-}
+ }
+}
diff --git a/library/cpp/messagebus/rain_check/core/coro_ut.cpp b/library/cpp/messagebus/rain_check/core/coro_ut.cpp
index 95edce680b..61a33584a5 100644
--- a/library/cpp/messagebus/rain_check/core/coro_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/coro_ut.cpp
@@ -8,7 +8,7 @@
using namespace NRainCheck;
Y_UNIT_TEST_SUITE(RainCheckCoro) {
- struct TSimpleCoroTask : ICoroTask {
+ struct TSimpleCoroTask : ICoroTask {
TTestSync* const TestSync;
TSimpleCoroTask(TTestEnv*, TTestSync* testSync)
@@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(RainCheckCoro) {
testSync.WaitForAndIncrement(1);
}
- struct TSleepCoroTask : ICoroTask {
+ struct TSleepCoroTask : ICoroTask {
TTestEnv* const Env;
TTestSync* const TestSync;
@@ -59,7 +59,7 @@ Y_UNIT_TEST_SUITE(RainCheckCoro) {
testSync.WaitForAndIncrement(1);
}
- struct TSubtask : ICoroTask {
+ struct TSubtask : ICoroTask {
TTestEnv* const Env;
TTestSync* const TestSync;
@@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(RainCheckCoro) {
}
};
- struct TSpawnCoroTask : ICoroTask {
+ struct TSpawnCoroTask : ICoroTask {
TTestEnv* const Env;
TTestSync* const TestSync;
diff --git a/library/cpp/messagebus/rain_check/core/env.h b/library/cpp/messagebus/rain_check/core/env.h
index 945364c3b3..f6dd7fceb6 100644
--- a/library/cpp/messagebus/rain_check/core/env.h
+++ b/library/cpp/messagebus/rain_check/core/env.h
@@ -10,15 +10,15 @@
namespace NRainCheck {
struct IEnv {
virtual ::NActor::TExecutor* GetExecutor() = 0;
- virtual ~IEnv() {
- }
+ virtual ~IEnv() {
+ }
};
template <typename TSelf>
struct TEnvTemplate: public IEnv {
template <typename TTask, typename TParam>
TIntrusivePtr<typename TTask::TTaskRunner> SpawnTask(TParam param) {
- return ::NRainCheck::SpawnTask<TTask, TSelf>((TSelf*)this, param);
+ return ::NRainCheck::SpawnTask<TTask, TSelf>((TSelf*)this, param);
}
};
@@ -29,19 +29,19 @@ namespace NRainCheck {
TSimpleEnvTemplate(unsigned threadCount = 0)
: Executor(new ::NActor::TExecutor(threadCount != 0 ? threadCount : 4))
- {
- }
+ {
+ }
- ::NActor::TExecutor* GetExecutor() override {
- return Executor.Get();
- }
+ ::NActor::TExecutor* GetExecutor() override {
+ return Executor.Get();
+ }
};
struct TSimpleEnv: public TSimpleEnvTemplate<TSimpleEnv> {
- TSimpleEnv(unsigned threadCount = 0)
- : TSimpleEnvTemplate<TSimpleEnv>(threadCount)
- {
- }
+ TSimpleEnv(unsigned threadCount = 0)
+ : TSimpleEnvTemplate<TSimpleEnv>(threadCount)
+ {
+ }
};
}
diff --git a/library/cpp/messagebus/rain_check/core/simple.cpp b/library/cpp/messagebus/rain_check/core/simple.cpp
index 46a1d0e8aa..70182b2f93 100644
--- a/library/cpp/messagebus/rain_check/core/simple.cpp
+++ b/library/cpp/messagebus/rain_check/core/simple.cpp
@@ -12,7 +12,7 @@ TSimpleTaskRunner::~TSimpleTaskRunner() {
Y_ASSERT(!ContinueFunc);
}
-bool TSimpleTaskRunner::ReplyReceived() {
+bool TSimpleTaskRunner::ReplyReceived() {
ContinueFunc = (GetImpl()->*(ContinueFunc.Func))();
return !!ContinueFunc;
}
diff --git a/library/cpp/messagebus/rain_check/core/simple.h b/library/cpp/messagebus/rain_check/core/simple.h
index 82664cabab..20e1bf19f5 100644
--- a/library/cpp/messagebus/rain_check/core/simple.h
+++ b/library/cpp/messagebus/rain_check/core/simple.h
@@ -15,17 +15,17 @@ namespace NRainCheck {
public:
TContinueFunc()
: Func(nullptr)
- {
- }
+ {
+ }
TContinueFunc(void*)
: Func(nullptr)
- {
- }
+ {
+ }
template <typename TTask>
TContinueFunc(TContinueFunc (TTask::*func)())
- : Func((TFunc)func)
+ : Func((TFunc)func)
{
static_assert((std::is_base_of<ISimpleTask, TTask>::value), "expect (std::is_base_of<ISimpleTask, TTask>::value)");
}
@@ -46,9 +46,9 @@ namespace NRainCheck {
bool ReplyReceived() override /* override */;
- ISimpleTask* GetImpl() {
- return (ISimpleTask*)GetImplBase();
- }
+ ISimpleTask* GetImpl() {
+ return (ISimpleTask*)GetImplBase();
+ }
};
class ISimpleTask: public ITaskBase {
diff --git a/library/cpp/messagebus/rain_check/core/simple_ut.cpp b/library/cpp/messagebus/rain_check/core/simple_ut.cpp
index 820996d11a..d4545e05aa 100644
--- a/library/cpp/messagebus/rain_check/core/simple_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/simple_ut.cpp
@@ -16,8 +16,8 @@ Y_UNIT_TEST_SUITE(RainCheckSimple) {
TTaskWithCompletionCallback(TTestEnv* env, TTestSync* testSync)
: Env(env)
, TestSync(testSync)
- {
- }
+ {
+ }
TSubtaskCompletion SleepCompletion;
@@ -38,7 +38,7 @@ Y_UNIT_TEST_SUITE(RainCheckSimple) {
SleepCompletion.SetCompletionCallback(&TTaskWithCompletionCallback::NextSleepCompletionCallback);
}
- void NextSleepCompletionCallback(TSubtaskCompletion*) {
+ void NextSleepCompletionCallback(TSubtaskCompletion*) {
TestSync->CheckAndIncrement(2);
}
diff --git a/library/cpp/messagebus/rain_check/core/sleep.cpp b/library/cpp/messagebus/rain_check/core/sleep.cpp
index 4fb645b7d6..f5d0b4cac9 100644
--- a/library/cpp/messagebus/rain_check/core/sleep.cpp
+++ b/library/cpp/messagebus/rain_check/core/sleep.cpp
@@ -18,7 +18,7 @@ NRainCheck::TSleepService::TSleepService()
{
}
-NRainCheck::TSleepService::~TSleepService() {
+NRainCheck::TSleepService::~TSleepService() {
if (!!SchedulerHolder) {
Scheduler->Stop();
}
@@ -40,7 +40,7 @@ namespace {
};
}
-void TSleepService::Sleep(TSubtaskCompletion* r, TDuration duration) {
+void TSleepService::Sleep(TSubtaskCompletion* r, TDuration duration) {
TTaskRunnerBase* current = TTaskRunnerBase::CurrentTask();
r->SetRunning(current);
Scheduler->Schedule(new TSleepServiceScheduleItem(r, TInstant::Now() + duration));
diff --git a/library/cpp/messagebus/rain_check/core/sleep.h b/library/cpp/messagebus/rain_check/core/sleep.h
index dc63c098df..1a7a1f8674 100644
--- a/library/cpp/messagebus/rain_check/core/sleep.h
+++ b/library/cpp/messagebus/rain_check/core/sleep.h
@@ -11,7 +11,7 @@ namespace NRainCheck {
private:
THolder< ::NBus::NPrivate::TScheduler> SchedulerHolder;
::NBus::NPrivate::TScheduler* const Scheduler;
-
+
public:
TSleepService(::NBus::NPrivate::TScheduler*);
TSleepService();
diff --git a/library/cpp/messagebus/rain_check/core/sleep_ut.cpp b/library/cpp/messagebus/rain_check/core/sleep_ut.cpp
index cddcb2b44a..2ae85a87b1 100644
--- a/library/cpp/messagebus/rain_check/core/sleep_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/sleep_ut.cpp
@@ -15,8 +15,8 @@ Y_UNIT_TEST_SUITE(Sleep) {
TTestTask(TSimpleEnv* env, TTestSync* testSync)
: Env(env)
, TestSync(testSync)
- {
- }
+ {
+ }
TSubtaskCompletion Sleep;
diff --git a/library/cpp/messagebus/rain_check/core/spawn.cpp b/library/cpp/messagebus/rain_check/core/spawn.cpp
index 879192e26a..c570355fbe 100644
--- a/library/cpp/messagebus/rain_check/core/spawn.cpp
+++ b/library/cpp/messagebus/rain_check/core/spawn.cpp
@@ -1,5 +1,5 @@
#include "spawn.h"
-void NRainCheck::NPrivate::SpawnTaskImpl(TTaskRunnerBase* task) {
+void NRainCheck::NPrivate::SpawnTaskImpl(TTaskRunnerBase* task) {
task->Schedule();
}
diff --git a/library/cpp/messagebus/rain_check/core/spawn.h b/library/cpp/messagebus/rain_check/core/spawn.h
index f61b8cc8c2..f2b146bf29 100644
--- a/library/cpp/messagebus/rain_check/core/spawn.h
+++ b/library/cpp/messagebus/rain_check/core/spawn.h
@@ -38,7 +38,7 @@ namespace NRainCheck {
template <typename TTask, typename TEnv, typename TParam>
TIntrusivePtr<typename TTask::TTaskRunner> SpawnTask(TEnv* env, TParam param1, ISubtaskListener* subtaskListener = &TNopSubtaskListener::Instance) {
return NPrivate::SpawnTaskWithRunner<
- TTask, typename TTask::ITask, typename TTask::TTaskRunner, TEnv, TParam>(env, param1, subtaskListener);
+ TTask, typename TTask::ITask, typename TTask::TTaskRunner, TEnv, TParam>(env, param1, subtaskListener);
}
// Instantiate and start subtask of given task.
diff --git a/library/cpp/messagebus/rain_check/core/spawn_ut.cpp b/library/cpp/messagebus/rain_check/core/spawn_ut.cpp
index a0391953e9..ba5a5e41cf 100644
--- a/library/cpp/messagebus/rain_check/core/spawn_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/spawn_ut.cpp
@@ -19,8 +19,8 @@ Y_UNIT_TEST_SUITE(Spawn) {
TTestTask(TSimpleEnv*, TTestSync* testSync)
: TestSync(testSync)
, I(0)
- {
- }
+ {
+ }
TSystemEvent Started;
@@ -60,8 +60,8 @@ Y_UNIT_TEST_SUITE(Spawn) {
TSubtask(TTestEnv* env, TTestSync* testSync)
: Env(env)
, TestSync(testSync)
- {
- }
+ {
+ }
TContinueFunc Start() override {
Sleep(TDuration::MilliSeconds(1));
@@ -77,8 +77,8 @@ Y_UNIT_TEST_SUITE(Spawn) {
TSpawnTask(TTestEnv* env, TTestSync* testSync)
: Env(env)
, TestSync(testSync)
- {
- }
+ {
+ }
TSubtaskCompletion SubtaskCompletion;
@@ -109,12 +109,12 @@ Y_UNIT_TEST_SUITE(Spawn) {
TTestSync* const TestSync;
unsigned I;
- TSpawnLongTask(TTestEnv* env, TTestSync* testSync)
- : Env(env)
- , TestSync(testSync)
- , I(0)
- {
- }
+ TSpawnLongTask(TTestEnv* env, TTestSync* testSync)
+ : Env(env)
+ , TestSync(testSync)
+ , I(0)
+ {
+ }
std::array<TSubtaskCompletion, 3> Subtasks;
diff --git a/library/cpp/messagebus/rain_check/core/task.cpp b/library/cpp/messagebus/rain_check/core/task.cpp
index 3c5c609d07..a098437d53 100644
--- a/library/cpp/messagebus/rain_check/core/task.cpp
+++ b/library/cpp/messagebus/rain_check/core/task.cpp
@@ -11,12 +11,12 @@ using namespace NRainCheck::NPrivate;
using namespace NActor;
namespace {
- Y_POD_STATIC_THREAD(TTaskRunnerBase*)
- ThreadCurrentTask;
+ Y_POD_STATIC_THREAD(TTaskRunnerBase*)
+ ThreadCurrentTask;
}
-void TNopSubtaskListener::SetDone() {
-}
+void TNopSubtaskListener::SetDone() {
+}
TNopSubtaskListener TNopSubtaskListener::Instance;
@@ -46,12 +46,12 @@ namespace {
~TRunningInThisThreadGuard() {
Y_ASSERT(ThreadCurrentTask == Task);
- ThreadCurrentTask = nullptr;
+ ThreadCurrentTask = nullptr;
}
};
}
-void NRainCheck::TTaskRunnerBase::Act(NActor::TDefaultTag) {
+void NRainCheck::TTaskRunnerBase::Act(NActor::TDefaultTag) {
Y_ASSERT(RefCount() > 0);
TRunningInThisThreadGuard g(this);
@@ -90,16 +90,16 @@ void NRainCheck::TTaskRunnerBase::Act(NActor::TDefaultTag) {
}
}
-bool TTaskRunnerBase::IsRunningInThisThread() const {
+bool TTaskRunnerBase::IsRunningInThisThread() const {
return ThreadCurrentTask == this;
}
-TSubtaskCompletion::~TSubtaskCompletion() {
+TSubtaskCompletion::~TSubtaskCompletion() {
ESubtaskState state = State.Get();
Y_ASSERT(state == CREATED || state == DONE || state == CANCELED);
}
-void TSubtaskCompletion::FireCompletionCallback(ITaskBase* task) {
+void TSubtaskCompletion::FireCompletionCallback(ITaskBase* task) {
Y_ASSERT(IsComplete());
if (!!CompletionFunc) {
@@ -111,7 +111,7 @@ void TSubtaskCompletion::FireCompletionCallback(ITaskBase* task) {
}
}
-void NRainCheck::TSubtaskCompletion::Cancel() {
+void NRainCheck::TSubtaskCompletion::Cancel() {
for (;;) {
ESubtaskState state = State.Get();
if (state == CREATED && State.CompareAndSet(CREATED, CANCELED)) {
@@ -129,7 +129,7 @@ void NRainCheck::TSubtaskCompletion::Cancel() {
}
}
-void TSubtaskCompletion::SetRunning(TTaskRunnerBase* parent) {
+void TSubtaskCompletion::SetRunning(TTaskRunnerBase* parent) {
Y_ASSERT(!TaskRunner);
Y_ASSERT(!!parent);
@@ -150,7 +150,7 @@ void TSubtaskCompletion::SetRunning(TTaskRunnerBase* parent) {
}
}
-void TSubtaskCompletion::SetDone() {
+void TSubtaskCompletion::SetDone() {
Y_ASSERT(!!TaskRunner);
TTaskRunnerBase* temp = TaskRunner;
TaskRunner = nullptr;
@@ -194,11 +194,11 @@ void NRainCheck::TTaskRunnerBase::ReleaseRef()
}
#endif
-void TTaskRunnerBase::AssertInThisThread() const {
+void TTaskRunnerBase::AssertInThisThread() const {
Y_ASSERT(IsRunningInThisThread());
}
-TTaskRunnerBase* TTaskRunnerBase::CurrentTask() {
+TTaskRunnerBase* TTaskRunnerBase::CurrentTask() {
Y_VERIFY(!!ThreadCurrentTask);
return ThreadCurrentTask;
}
diff --git a/library/cpp/messagebus/rain_check/core/task.h b/library/cpp/messagebus/rain_check/core/task.h
index 16a0b3cb19..7d8778bcda 100644
--- a/library/cpp/messagebus/rain_check/core/task.h
+++ b/library/cpp/messagebus/rain_check/core/task.h
@@ -14,8 +14,8 @@
namespace NRainCheck {
struct ISubtaskListener {
virtual void SetDone() = 0;
- virtual ~ISubtaskListener() {
- }
+ virtual ~ISubtaskListener() {
+ }
};
struct TNopSubtaskListener: public ISubtaskListener {
@@ -33,17 +33,17 @@ namespace NRainCheck {
public:
TSubtaskCompletionFunc()
: Func(nullptr)
- {
- }
+ {
+ }
TSubtaskCompletionFunc(void*)
: Func(nullptr)
- {
- }
+ {
+ }
template <typename TTask>
TSubtaskCompletionFunc(void (TTask::*func)(TSubtaskCompletion*))
- : Func((TFunc)func)
+ : Func((TFunc)func)
{
static_assert((std::is_base_of<ITaskBase, TTask>::value), "expect (std::is_base_of<ITaskBase, TTask>::value)");
}
@@ -56,13 +56,13 @@ namespace NRainCheck {
template <typename T>
class TTaskFuture;
-#define SUBTASK_STATE_MAP(XX) \
- XX(CREATED, "Initial") \
- XX(RUNNING, "Running") \
- XX(DONE, "Completed") \
- XX(CANCEL_REQUESTED, "Cancel requested, but still executing") \
- XX(CANCELED, "Canceled") \
- /**/
+#define SUBTASK_STATE_MAP(XX) \
+ XX(CREATED, "Initial") \
+ XX(RUNNING, "Running") \
+ XX(DONE, "Completed") \
+ XX(CANCEL_REQUESTED, "Cancel requested, but still executing") \
+ XX(CANCELED, "Canceled") \
+ /**/
enum ESubtaskState {
SUBTASK_STATE_MAP(ENUM_VALUE_GEN_NO_VALUE)
@@ -70,38 +70,38 @@ namespace NRainCheck {
ENUM_TO_STRING(ESubtaskState, SUBTASK_STATE_MAP)
- class TSubtaskCompletion : TNonCopyable, public ISubtaskListener {
+ class TSubtaskCompletion : TNonCopyable, public ISubtaskListener {
friend struct TTaskAccessor;
-
+
private:
TAtomicBox<ESubtaskState> State;
TTaskRunnerBase* volatile TaskRunner;
TSubtaskCompletionFunc CompletionFunc;
-
+
public:
- TSubtaskCompletion()
- : State(CREATED)
- , TaskRunner()
- {
- }
+ TSubtaskCompletion()
+ : State(CREATED)
+ , TaskRunner()
+ {
+ }
~TSubtaskCompletion() override;
// Either done or cancel requested or cancelled
bool IsComplete() const {
ESubtaskState state = State.Get();
switch (state) {
- case RUNNING:
- return false;
- case DONE:
- return true;
- case CANCEL_REQUESTED:
- return false;
- case CANCELED:
- return true;
- case CREATED:
- Y_FAIL("not started");
- default:
- Y_FAIL("unknown value: %u", (unsigned)state);
+ case RUNNING:
+ return false;
+ case DONE:
+ return true;
+ case CANCEL_REQUESTED:
+ return false;
+ case CANCELED:
+ return true;
+ case CREATED:
+ Y_FAIL("not started");
+ default:
+ Y_FAIL("unknown value: %u", (unsigned)state);
}
}
@@ -128,7 +128,7 @@ namespace NRainCheck {
};
// See ISimpleTask, ICoroTask
- class TTaskRunnerBase: public TAtomicRefCount<TTaskRunnerBase>, public NActor::TActor<TTaskRunnerBase> {
+ class TTaskRunnerBase: public TAtomicRefCount<TTaskRunnerBase>, public NActor::TActor<TTaskRunnerBase> {
friend class NActor::TActor<TTaskRunnerBase>;
friend class TContinueFunc;
friend struct TTaskAccessor;
@@ -163,9 +163,9 @@ namespace NRainCheck {
protected:
//void RetainRef();
//void ReleaseRef();
- ITaskBase* GetImplBase() {
- return Impl.Get();
- }
+ ITaskBase* GetImplBase() {
+ return Impl.Get();
+ }
private:
// true if need to call again
@@ -174,11 +174,11 @@ namespace NRainCheck {
class ITaskBase {
public:
- virtual ~ITaskBase() {
- }
+ virtual ~ITaskBase() {
+ }
};
// Check that current method executed inside some task.
bool AreWeInsideTask();
-}
+}
diff --git a/library/cpp/messagebus/rain_check/core/track.cpp b/library/cpp/messagebus/rain_check/core/track.cpp
index d704ee022a..092a51a214 100644
--- a/library/cpp/messagebus/rain_check/core/track.cpp
+++ b/library/cpp/messagebus/rain_check/core/track.cpp
@@ -3,7 +3,7 @@
using namespace NRainCheck;
using namespace NRainCheck::NPrivate;
-void TTaskTrackerReceipt::SetDone() {
+void TTaskTrackerReceipt::SetDone() {
TaskTracker->GetQueue<TTaskTrackerReceipt*>()->EnqueueAndSchedule(this);
}
@@ -11,12 +11,12 @@ TString TTaskTrackerReceipt::GetStatusSingleLine() {
return Task->GetStatusSingleLine();
}
-TTaskTracker::TTaskTracker(NActor::TExecutor* executor)
- : NActor::TActor<TTaskTracker>(executor)
+TTaskTracker::TTaskTracker(NActor::TExecutor* executor)
+ : NActor::TActor<TTaskTracker>(executor)
{
}
-TTaskTracker::~TTaskTracker() {
+TTaskTracker::~TTaskTracker() {
Y_ASSERT(Tasks.Empty());
}
@@ -47,7 +47,7 @@ void TTaskTracker::ProcessItem(NActor::TDefaultTag, NActor::TDefaultTag, TAsyncR
status->SetResult(s);
}
-void TTaskTracker::Act(NActor::TDefaultTag) {
+void TTaskTracker::Act(NActor::TDefaultTag) {
GetQueue<TAsyncResult<TTaskTrackerStatus>*>()->DequeueAll();
GetQueue<ITaskFactory*>()->DequeueAll();
GetQueue<TTaskTrackerReceipt*>()->DequeueAll();
diff --git a/library/cpp/messagebus/rain_check/core/track.h b/library/cpp/messagebus/rain_check/core/track.h
index 88a4e6fd9e..d387de7574 100644
--- a/library/cpp/messagebus/rain_check/core/track.h
+++ b/library/cpp/messagebus/rain_check/core/track.h
@@ -16,18 +16,18 @@ namespace NRainCheck {
namespace NPrivate {
struct ITaskFactory {
virtual TIntrusivePtr<TTaskRunnerBase> NewTask(ISubtaskListener*) = 0;
- virtual ~ITaskFactory() {
- }
+ virtual ~ITaskFactory() {
+ }
};
struct TTaskTrackerReceipt: public ISubtaskListener, public TIntrusiveListItem<TTaskTrackerReceipt> {
TTaskTracker* const TaskTracker;
TIntrusivePtr<TTaskRunnerBase> Task;
- TTaskTrackerReceipt(TTaskTracker* taskTracker)
- : TaskTracker(taskTracker)
- {
- }
+ TTaskTrackerReceipt(TTaskTracker* taskTracker)
+ : TaskTracker(taskTracker)
+ {
+ }
void SetDone() override;
@@ -41,11 +41,11 @@ namespace NRainCheck {
}
class TTaskTracker
- : public TAtomicRefCount<TTaskTracker>,
- public NActor::TActor<TTaskTracker>,
- public NActor::TQueueInActor<TTaskTracker, NPrivate::ITaskFactory*>,
- public NActor::TQueueInActor<TTaskTracker, NPrivate::TTaskTrackerReceipt*>,
- public NActor::TQueueInActor<TTaskTracker, TAsyncResult<NPrivate::TTaskTrackerStatus>*> {
+ : public TAtomicRefCount<TTaskTracker>,
+ public NActor::TActor<TTaskTracker>,
+ public NActor::TQueueInActor<TTaskTracker, NPrivate::ITaskFactory*>,
+ public NActor::TQueueInActor<TTaskTracker, NPrivate::TTaskTrackerReceipt*>,
+ public NActor::TQueueInActor<TTaskTracker, TAsyncResult<NPrivate::TTaskTrackerStatus>*> {
friend struct NPrivate::TTaskTrackerReceipt;
private:
@@ -77,11 +77,11 @@ namespace NRainCheck {
TEnv* const Env;
TParam Param;
- TTaskFactory(TEnv* env, TParam param)
- : Env(env)
- , Param(param)
- {
- }
+ TTaskFactory(TEnv* env, TParam param)
+ : Env(env)
+ , Param(param)
+ {
+ }
TIntrusivePtr<TTaskRunnerBase> NewTask(ISubtaskListener* subtaskListener) override {
return NRainCheck::SpawnTask<TTask>(Env, Param, subtaskListener).Get();
diff --git a/library/cpp/messagebus/rain_check/core/track_ut.cpp b/library/cpp/messagebus/rain_check/core/track_ut.cpp
index ef76a7a2af..05f7de1319 100644
--- a/library/cpp/messagebus/rain_check/core/track_ut.cpp
+++ b/library/cpp/messagebus/rain_check/core/track_ut.cpp
@@ -11,10 +11,10 @@ Y_UNIT_TEST_SUITE(TaskTracker) {
struct TTaskForTracker: public ISimpleTask {
TTestSync* const TestSync;
- TTaskForTracker(TTestEnv*, TTestSync* testSync)
- : TestSync(testSync)
- {
- }
+ TTaskForTracker(TTestEnv*, TTestSync* testSync)
+ : TestSync(testSync)
+ {
+ }
TContinueFunc Start() override {
TestSync->WaitForAndIncrement(0);