#pragma once #include "sleep.h" #include "spawn.h" #include #include namespace NRainCheck { struct IEnv { virtual ::NActor::TExecutor* GetExecutor() = 0; virtual ~IEnv() { } }; template struct TEnvTemplate: public IEnv { template TIntrusivePtr SpawnTask(TParam param) { return ::NRainCheck::SpawnTask((TSelf*)this, param); } }; template struct TSimpleEnvTemplate: public TEnvTemplate { ::NActor::TExecutorPtr Executor; TSleepService SleepService; TSimpleEnvTemplate(unsigned threadCount = 0) : Executor(new ::NActor::TExecutor(threadCount != 0 ? threadCount : 4)) { } ::NActor::TExecutor* GetExecutor() override { return Executor.Get(); } }; struct TSimpleEnv: public TSimpleEnvTemplate { TSimpleEnv(unsigned threadCount = 0) : TSimpleEnvTemplate(threadCount) { } }; }