diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2023-12-04 15:32:14 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2023-12-05 01:22:50 +0300 |
commit | c21ed9eedf73010bc81342518177dfdfb0d56bd7 (patch) | |
tree | 72f8fde4463080cfe5a38eb0babc051cfe32c51e /library/cpp/actors/cppcoro | |
parent | ec1311bf2e8cc231723b8b5e484ca576663a1309 (diff) | |
download | ydb-c21ed9eedf73010bc81342518177dfdfb0d56bd7.tar.gz |
Intermediate changes
Diffstat (limited to 'library/cpp/actors/cppcoro')
34 files changed, 0 insertions, 2196 deletions
diff --git a/library/cpp/actors/cppcoro/CMakeLists.darwin-arm64.txt b/library/cpp/actors/cppcoro/CMakeLists.darwin-arm64.txt deleted file mode 100644 index 9795130141..0000000000 --- a/library/cpp/actors/cppcoro/CMakeLists.darwin-arm64.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -add_subdirectory(corobenchmark) -add_subdirectory(ut) - -add_library(cpp-actors-cppcoro) -target_link_libraries(cpp-actors-cppcoro PUBLIC - contrib-libs-cxxsupp - yutil - cpp-actors-core -) -target_sources(cpp-actors-cppcoro PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/await_callback.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_group.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_result.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task.cpp -) diff --git a/library/cpp/actors/cppcoro/CMakeLists.darwin-x86_64.txt b/library/cpp/actors/cppcoro/CMakeLists.darwin-x86_64.txt deleted file mode 100644 index 9795130141..0000000000 --- a/library/cpp/actors/cppcoro/CMakeLists.darwin-x86_64.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -add_subdirectory(corobenchmark) -add_subdirectory(ut) - -add_library(cpp-actors-cppcoro) -target_link_libraries(cpp-actors-cppcoro PUBLIC - contrib-libs-cxxsupp - yutil - cpp-actors-core -) -target_sources(cpp-actors-cppcoro PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/await_callback.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_group.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_result.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task.cpp -) diff --git a/library/cpp/actors/cppcoro/CMakeLists.linux-aarch64.txt b/library/cpp/actors/cppcoro/CMakeLists.linux-aarch64.txt deleted file mode 100644 index 514824dad2..0000000000 --- a/library/cpp/actors/cppcoro/CMakeLists.linux-aarch64.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -add_subdirectory(corobenchmark) -add_subdirectory(ut) - -add_library(cpp-actors-cppcoro) -target_link_libraries(cpp-actors-cppcoro PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - cpp-actors-core -) -target_sources(cpp-actors-cppcoro PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/await_callback.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_group.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_result.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task.cpp -) diff --git a/library/cpp/actors/cppcoro/CMakeLists.linux-x86_64.txt b/library/cpp/actors/cppcoro/CMakeLists.linux-x86_64.txt deleted file mode 100644 index 514824dad2..0000000000 --- a/library/cpp/actors/cppcoro/CMakeLists.linux-x86_64.txt +++ /dev/null @@ -1,25 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -add_subdirectory(corobenchmark) -add_subdirectory(ut) - -add_library(cpp-actors-cppcoro) -target_link_libraries(cpp-actors-cppcoro PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - cpp-actors-core -) -target_sources(cpp-actors-cppcoro PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/await_callback.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_group.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_result.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task.cpp -) diff --git a/library/cpp/actors/cppcoro/CMakeLists.txt b/library/cpp/actors/cppcoro/CMakeLists.txt deleted file mode 100644 index 2dce3a77fe..0000000000 --- a/library/cpp/actors/cppcoro/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA) - include(CMakeLists.linux-aarch64.txt) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - include(CMakeLists.darwin-x86_64.txt) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") - include(CMakeLists.darwin-arm64.txt) -elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA) - include(CMakeLists.windows-x86_64.txt) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA) - include(CMakeLists.linux-x86_64.txt) -endif() diff --git a/library/cpp/actors/cppcoro/CMakeLists.windows-x86_64.txt b/library/cpp/actors/cppcoro/CMakeLists.windows-x86_64.txt deleted file mode 100644 index 9795130141..0000000000 --- a/library/cpp/actors/cppcoro/CMakeLists.windows-x86_64.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -add_subdirectory(corobenchmark) -add_subdirectory(ut) - -add_library(cpp-actors-cppcoro) -target_link_libraries(cpp-actors-cppcoro PUBLIC - contrib-libs-cxxsupp - yutil - cpp-actors-core -) -target_sources(cpp-actors-cppcoro PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/await_callback.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_group.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_result.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task.cpp -) diff --git a/library/cpp/actors/cppcoro/await_callback.cpp b/library/cpp/actors/cppcoro/await_callback.cpp deleted file mode 100644 index 5132131a8e..0000000000 --- a/library/cpp/actors/cppcoro/await_callback.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "await_callback.h" diff --git a/library/cpp/actors/cppcoro/await_callback.h b/library/cpp/actors/cppcoro/await_callback.h deleted file mode 100644 index fcb2eb78f9..0000000000 --- a/library/cpp/actors/cppcoro/await_callback.h +++ /dev/null @@ -1,100 +0,0 @@ -#include <coroutine> -#include <exception> -#include <concepts> - -namespace NActors { - - namespace NDetail { - - template<class TAwaitable> - decltype(auto) GetAwaiter(TAwaitable&& awaitable) { - if constexpr (requires { ((TAwaitable&&) awaitable).operator co_await(); }) { - return ((TAwaitable&&) awaitable).operator co_await(); - } else if constexpr (requires { operator co_await((TAwaitable&&) awaitable); }) { - return operator co_await((TAwaitable&&) awaitable); - } else { - return ((TAwaitable&&) awaitable); - } - } - - template<class TAwaitable> - using TAwaitResult = decltype(GetAwaiter(std::declval<TAwaitable>()).await_resume()); - - template<class TCallback, class TResult> - class TCallbackResult { - public: - TCallbackResult(TCallback& callback) - : Callback(callback) - {} - - template<class TRealResult> - void return_value(TRealResult&& result) noexcept { - Callback(std::forward<TRealResult>(result)); - } - - private: - TCallback& Callback; - }; - - template<class TCallback> - class TCallbackResult<TCallback, void> { - public: - TCallbackResult(TCallback& callback) - : Callback(callback) - {} - - void return_void() noexcept { - Callback(); - } - - private: - TCallback& Callback; - }; - - template<class TAwaitable, class TCallback> - class TAwaitThenCallbackPromise - : public TCallbackResult<TCallback, TAwaitResult<TAwaitable>> - { - public: - using THandle = std::coroutine_handle<TAwaitThenCallbackPromise<TAwaitable, TCallback>>; - - TAwaitThenCallbackPromise(TAwaitable&, TCallback& callback) - : TCallbackResult<TCallback, TAwaitResult<TAwaitable>>(callback) - {} - - THandle get_return_object() noexcept { - return THandle::from_promise(*this); - } - - static auto initial_suspend() noexcept { return std::suspend_never{}; } - static auto final_suspend() noexcept { return std::suspend_never{}; } - - void unhandled_exception() noexcept { - std::terminate(); - } - }; - - template<class TAwaitable, class TCallback> - class TAwaitThenCallback { - public: - using promise_type = TAwaitThenCallbackPromise<TAwaitable, TCallback>; - - using THandle = typename promise_type::THandle; - - TAwaitThenCallback(THandle) noexcept {} - }; - - } // namespace NDetail - - /** - * Awaits the awaitable and calls callback with the result. - * - * Note: program terminates if awaitable or callback throw an exception. - */ - template<class TAwaitable, class TCallback> - NDetail::TAwaitThenCallback<TAwaitable, TCallback> AwaitThenCallback(TAwaitable awaitable, TCallback) { - // Note: underlying promise takes callback argument address and calls it when we return - co_return co_await std::move(awaitable); - } - -} // namespace NActors diff --git a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.darwin-arm64.txt b/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.darwin-arm64.txt deleted file mode 100644 index 1043b6f834..0000000000 --- a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.darwin-arm64.txt +++ /dev/null @@ -1,30 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(corobenchmark) -target_link_libraries(corobenchmark PUBLIC - contrib-libs-cxxsupp - yutil - testing-benchmark-main - cpp-actors-cppcoro -) -target_link_options(corobenchmark PRIVATE - -Wl,-platform_version,macos,11.0,11.0 - -fPIC - -fPIC - -framework - CoreFoundation -) -target_sources(corobenchmark PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/corobenchmark/main.cpp -) -target_allocator(corobenchmark - system_allocator -) -vcs_info(corobenchmark) diff --git a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.darwin-x86_64.txt b/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.darwin-x86_64.txt deleted file mode 100644 index 1b98f8aac0..0000000000 --- a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.darwin-x86_64.txt +++ /dev/null @@ -1,31 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(corobenchmark) -target_link_libraries(corobenchmark PUBLIC - contrib-libs-cxxsupp - yutil - library-cpp-cpuid_check - testing-benchmark-main - cpp-actors-cppcoro -) -target_link_options(corobenchmark PRIVATE - -Wl,-platform_version,macos,11.0,11.0 - -fPIC - -fPIC - -framework - CoreFoundation -) -target_sources(corobenchmark PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/corobenchmark/main.cpp -) -target_allocator(corobenchmark - system_allocator -) -vcs_info(corobenchmark) diff --git a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.linux-aarch64.txt b/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.linux-aarch64.txt deleted file mode 100644 index f12dfdad8d..0000000000 --- a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.linux-aarch64.txt +++ /dev/null @@ -1,34 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(corobenchmark) -target_link_libraries(corobenchmark PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - testing-benchmark-main - cpp-actors-cppcoro -) -target_link_options(corobenchmark PRIVATE - -ldl - -lrt - -Wl,--no-as-needed - -fPIC - -fPIC - -lpthread - -lrt - -ldl -) -target_sources(corobenchmark PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/corobenchmark/main.cpp -) -target_allocator(corobenchmark - cpp-malloc-jemalloc -) -vcs_info(corobenchmark) diff --git a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.linux-x86_64.txt b/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.linux-x86_64.txt deleted file mode 100644 index e5b37926d1..0000000000 --- a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.linux-x86_64.txt +++ /dev/null @@ -1,36 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(corobenchmark) -target_link_libraries(corobenchmark PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - library-cpp-cpuid_check - testing-benchmark-main - cpp-actors-cppcoro -) -target_link_options(corobenchmark PRIVATE - -ldl - -lrt - -Wl,--no-as-needed - -fPIC - -fPIC - -lpthread - -lrt - -ldl -) -target_sources(corobenchmark PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/corobenchmark/main.cpp -) -target_allocator(corobenchmark - cpp-malloc-tcmalloc - libs-tcmalloc-no_percpu_cache -) -vcs_info(corobenchmark) diff --git a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.txt b/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.txt deleted file mode 100644 index 2dce3a77fe..0000000000 --- a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA) - include(CMakeLists.linux-aarch64.txt) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - include(CMakeLists.darwin-x86_64.txt) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") - include(CMakeLists.darwin-arm64.txt) -elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA) - include(CMakeLists.windows-x86_64.txt) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA) - include(CMakeLists.linux-x86_64.txt) -endif() diff --git a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.windows-x86_64.txt b/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.windows-x86_64.txt deleted file mode 100644 index c9a8359b4b..0000000000 --- a/library/cpp/actors/cppcoro/corobenchmark/CMakeLists.windows-x86_64.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(corobenchmark) -target_link_libraries(corobenchmark PUBLIC - contrib-libs-cxxsupp - yutil - library-cpp-cpuid_check - testing-benchmark-main - cpp-actors-cppcoro -) -target_sources(corobenchmark PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/corobenchmark/main.cpp -) -target_allocator(corobenchmark - system_allocator -) -vcs_info(corobenchmark) diff --git a/library/cpp/actors/cppcoro/corobenchmark/main.cpp b/library/cpp/actors/cppcoro/corobenchmark/main.cpp deleted file mode 100644 index 49504e7105..0000000000 --- a/library/cpp/actors/cppcoro/corobenchmark/main.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include <library/cpp/actors/cppcoro/task.h> -#include <library/cpp/actors/cppcoro/await_callback.h> -#include <library/cpp/testing/benchmark/bench.h> - -using namespace NActors; - -namespace { - - int LastValue = 0; - - Y_NO_INLINE int NextFuncValue() { - return ++LastValue; - } - - Y_NO_INLINE void IterateFuncValues(size_t iterations) { - for (size_t i = 0; i < iterations; ++i) { - int value = NextFuncValue(); - Y_DO_NOT_OPTIMIZE_AWAY(value); - } - } - - Y_NO_INLINE TTask<int> NextTaskValue() { - co_return ++LastValue; - } - - Y_NO_INLINE TTask<void> IterateTaskValues(size_t iterations) { - for (size_t i = 0; i < iterations; ++i) { - int value = co_await NextTaskValue(); - Y_DO_NOT_OPTIMIZE_AWAY(value); - } - } - - std::coroutine_handle<> Paused; - - struct { - static bool await_ready() noexcept { - return false; - } - static void await_suspend(std::coroutine_handle<> h) noexcept { - Paused = h; - } - static int await_resume() noexcept { - return ++LastValue; - } - } Pause; - - Y_NO_INLINE TTask<void> IteratePauseValues(size_t iterations) { - for (size_t i = 0; i < iterations; ++i) { - int value = co_await Pause; - Y_DO_NOT_OPTIMIZE_AWAY(value); - } - } - -} // namespace - -Y_CPU_BENCHMARK(FuncCalls, iface) { - IterateFuncValues(iface.Iterations()); -} - -Y_CPU_BENCHMARK(TaskCalls, iface) { - bool finished = false; - AwaitThenCallback(IterateTaskValues(iface.Iterations()), [&]{ - finished = true; - }); - Y_ABORT_UNLESS(finished); -} - -Y_CPU_BENCHMARK(CoroAwaits, iface) { - bool finished = false; - AwaitThenCallback(IteratePauseValues(iface.Iterations()), [&]{ - finished = true; - }); - while (!finished) { - std::exchange(Paused, {}).resume(); - } -} diff --git a/library/cpp/actors/cppcoro/corobenchmark/ya.make b/library/cpp/actors/cppcoro/corobenchmark/ya.make deleted file mode 100644 index ef5ad4135c..0000000000 --- a/library/cpp/actors/cppcoro/corobenchmark/ya.make +++ /dev/null @@ -1,11 +0,0 @@ -Y_BENCHMARK() - -PEERDIR( - library/cpp/actors/cppcoro -) - -SRCS( - main.cpp -) - -END() diff --git a/library/cpp/actors/cppcoro/task.cpp b/library/cpp/actors/cppcoro/task.cpp deleted file mode 100644 index 204c27c573..0000000000 --- a/library/cpp/actors/cppcoro/task.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "task.h" diff --git a/library/cpp/actors/cppcoro/task.h b/library/cpp/actors/cppcoro/task.h deleted file mode 100644 index bb5a385db2..0000000000 --- a/library/cpp/actors/cppcoro/task.h +++ /dev/null @@ -1,228 +0,0 @@ -#pragma once -#include "task_result.h" -#include <util/system/yassert.h> -#include <coroutine> -#include <utility> - -namespace NActors { - - template<class T> - class TTask; - - /** - * This exception is commonly thrown when task is cancelled - */ - class TTaskCancelled : public std::exception { - public: - const char* what() const noexcept { - return "Task cancelled"; - } - }; - - namespace NDetail { - - template<class T> - class TTaskPromise; - - template<class T> - using TTaskHandle = std::coroutine_handle<TTaskPromise<T>>; - - template<class T> - class TTaskAwaiter { - public: - explicit TTaskAwaiter(TTaskHandle<T> handle) - : Handle(handle) - { - Y_DEBUG_ABORT_UNLESS(Handle); - } - - TTaskAwaiter(TTaskAwaiter&& rhs) - : Handle(std::exchange(rhs.Handle, {})) - {} - - TTaskAwaiter& operator=(const TTaskAwaiter&) = delete; - TTaskAwaiter& operator=(TTaskAwaiter&&) = delete; - - ~TTaskAwaiter() noexcept { - if (Handle) { - Handle.destroy(); - } - } - - // We can only await a task that has not started yet - static bool await_ready() noexcept { return false; } - - // Some arbitrary continuation c suspended and awaits the task - TTaskHandle<T> await_suspend(std::coroutine_handle<> c) noexcept { - Y_DEBUG_ABORT_UNLESS(Handle); - Handle.promise().SetContinuation(c); - return Handle; - } - - TTaskResult<T>&& await_resume() noexcept { - Y_DEBUG_ABORT_UNLESS(Handle); - return std::move(Handle.promise().Result); - } - - private: - TTaskHandle<T> Handle; - }; - - template<class T> - class TTaskResultAwaiter final : public TTaskAwaiter<T> { - public: - using TTaskAwaiter<T>::TTaskAwaiter; - - T&& await_resume() { - return TTaskAwaiter<T>::await_resume().Value(); - } - }; - - template<> - class TTaskResultAwaiter<void> final : public TTaskAwaiter<void> { - public: - using TTaskAwaiter<void>::TTaskAwaiter; - - void await_resume() { - TTaskAwaiter<void>::await_resume().Value(); - } - }; - - template<class T> - class TTaskResultHandlerBase { - public: - void unhandled_exception() noexcept { - Result.SetException(std::current_exception()); - } - - protected: - TTaskResult<T> Result; - }; - - template<class T> - class TTaskResultHandler : public TTaskResultHandlerBase<T> { - public: - template<class TResult> - void return_value(TResult&& value) { - this->Result.SetValue(std::forward<TResult>(value)); - } - }; - - template<> - class TTaskResultHandler<void> : public TTaskResultHandlerBase<void> { - public: - void return_void() noexcept { - this->Result.SetValue(); - } - }; - - template<class T> - class TTaskPromise final - : public TTaskResultHandler<T> - { - friend class TTaskAwaiter<T>; - - public: - TTask<T> get_return_object() noexcept; - - static auto initial_suspend() noexcept { return std::suspend_always{}; } - - struct TFinalSuspend { - static bool await_ready() noexcept { return false; } - static void await_resume() noexcept { Y_ABORT("unexpected coroutine resume"); } - - static std::coroutine_handle<> await_suspend(std::coroutine_handle<TTaskPromise<T>> h) noexcept { - auto next = std::exchange(h.promise().Continuation, std::noop_coroutine()); - Y_DEBUG_ABORT_UNLESS(next, "Task finished without a continuation"); - return next; - } - }; - - static auto final_suspend() noexcept { return TFinalSuspend{}; } - - private: - void SetContinuation(std::coroutine_handle<> continuation) noexcept { - Y_DEBUG_ABORT_UNLESS(!Continuation, "Task can only be awaited once"); - Continuation = continuation; - } - - private: - std::coroutine_handle<> Continuation; - }; - - } // namespace NDetail - - /** - * Represents a task that has not been started yet - */ - template<class T> - class TTask final { - public: - using promise_type = NDetail::TTaskPromise<T>; - using value_type = T; - - public: - TTask() noexcept = default; - - explicit TTask(NDetail::TTaskHandle<T> handle) noexcept - : Handle(handle) - {} - - TTask(TTask&& rhs) noexcept - : Handle(std::exchange(rhs.Handle, {})) - {} - - ~TTask() { - if (Handle) { - Handle.destroy(); - } - } - - TTask& operator=(TTask&& rhs) noexcept { - if (Y_LIKELY(this != &rhs)) { - auto handle = std::exchange(Handle, {}); - Handle = std::exchange(rhs.Handle, {}); - if (handle) { - handle.destroy(); - } - } - return *this; - } - - /** - * Returns true for a valid task object - */ - explicit operator bool() const noexcept { - return bool(Handle); - } - - /** - * Starts task and returns TTaskResult<T> when it completes - */ - auto WhenDone() && noexcept { - Y_DEBUG_ABORT_UNLESS(Handle, "Cannot await an empty task"); - return NDetail::TTaskAwaiter<T>(std::exchange(Handle, {})); - } - - /** - * Starts task and returns its result when it completes - */ - auto operator co_await() && noexcept { - Y_DEBUG_ABORT_UNLESS(Handle, "Cannot await an empty task"); - return NDetail::TTaskResultAwaiter<T>(std::exchange(Handle, {})); - } - - private: - NDetail::TTaskHandle<T> Handle; - }; - - namespace NDetail { - - template<class T> - inline TTask<T> TTaskPromise<T>::get_return_object() noexcept { - return TTask<T>(TTaskHandle<T>::from_promise(*this)); - } - - } // namespace NDetail - -} // namespace NActors diff --git a/library/cpp/actors/cppcoro/task_actor.cpp b/library/cpp/actors/cppcoro/task_actor.cpp deleted file mode 100644 index 8a9451c8e5..0000000000 --- a/library/cpp/actors/cppcoro/task_actor.cpp +++ /dev/null @@ -1,183 +0,0 @@ -#include "task_actor.h" -#include "await_callback.h" -#include <library/cpp/actors/core/actor.h> -#include <library/cpp/actors/core/hfunc.h> - -namespace NActors { - - class TTaskActorImpl; - - static Y_POD_THREAD(TTaskActorImpl*) TlsCurrentTaskActor{nullptr}; - - struct TCurrentTaskActorGuard { - TCurrentTaskActorGuard(TTaskActorImpl* current) noexcept { - Y_ABORT_UNLESS(TlsCurrentTaskActor == nullptr); - TlsCurrentTaskActor = current; - } - - ~TCurrentTaskActorGuard() noexcept { - TlsCurrentTaskActor = nullptr; - } - }; - - enum : ui32 { - EvResumeTask = EventSpaceBegin(TEvents::ES_SYSTEM) + 256, - }; - - struct TEvResumeTask : public TEventLocal<TEvResumeTask, EvResumeTask> { - std::coroutine_handle<> Handle; - TTaskResult<void>* Result; - - explicit TEvResumeTask(std::coroutine_handle<> handle, TTaskResult<void>* result) noexcept - : Handle(handle) - , Result(result) - {} - - ~TEvResumeTask() noexcept { - if (Handle) { - Result->SetException(std::make_exception_ptr(TTaskCancelled())); - Handle.resume(); - } - } - }; - - class TTaskActorResult final : public TAtomicRefCount<TTaskActorResult> { - public: - bool Finished = false; - }; - - class TTaskActorImpl : public TActor<TTaskActorImpl> { - friend class TTaskActor; - friend class TAfterAwaiter; - friend class TBindAwaiter; - - public: - TTaskActorImpl(TTask<void>&& task) - : TActor(&TThis::StateBoot) - , Task(std::move(task)) - { - Y_ABORT_UNLESS(Task); - } - - ~TTaskActorImpl() { - Stopped = true; - while (EventAwaiter) { - // Unblock event awaiter until task stops trying - TCurrentTaskActorGuard guard(this); - std::exchange(EventAwaiter, {}).resume(); - } - } - - void Registered(TActorSystem* sys, const TActorId& parent) override { - ParentId = parent; - sys->Send(new IEventHandle(TEvents::TSystem::Bootstrap, 0, SelfId(), SelfId(), {}, 0)); - } - - STATEFN(StateBoot) { - Y_ABORT_UNLESS(ev->GetTypeRewrite() == TEvents::TSystem::Bootstrap, "Expected bootstrap event"); - TCurrentTaskActorGuard guard(this); - Become(&TThis::StateWork); - AwaitThenCallback(std::move(Task).WhenDone(), - [result = Result](TTaskResult<void>&& outcome) noexcept { - result->Finished = true; - try { - outcome.Value(); - } catch (TTaskCancelled&) { - // ignore - } - }); - Check(); - } - - STATEFN(StateWork) { - TCurrentTaskActorGuard guard(this); - switch (ev->GetTypeRewrite()) { - hFunc(TEvResumeTask, Handle); - default: - Y_ABORT_UNLESS(EventAwaiter); - Event.reset(ev.Release()); - std::exchange(EventAwaiter, {}).resume(); - } - Check(); - } - - void Handle(TEvResumeTask::TPtr& ev) { - auto* msg = ev->Get(); - msg->Result->SetValue(); - std::exchange(msg->Handle, {}).resume(); - } - - bool Check() { - if (Result->Finished) { - Y_ABORT_UNLESS(!EventAwaiter, "Task terminated while waiting for the next event"); - PassAway(); - return false; - } - - Y_ABORT_UNLESS(EventAwaiter, "Task suspended without waiting for the next event"); - return true; - } - - void WaitForEvent(std::coroutine_handle<> h) noexcept { - Y_ABORT_UNLESS(!EventAwaiter, "Task cannot have multiple awaiters for the next event"); - EventAwaiter = h; - } - - std::unique_ptr<IEventHandle> FinishWaitForEvent() { - if (Stopped) { - throw TTaskCancelled(); - } - Y_ABORT_UNLESS(Event, "Task does not have current event"); - return std::move(Event); - } - - private: - TIntrusivePtr<TTaskActorResult> Result = MakeIntrusive<TTaskActorResult>(); - TTask<void> Task; - TActorId ParentId; - std::coroutine_handle<> EventAwaiter; - std::unique_ptr<IEventHandle> Event; - bool Stopped = false; - }; - - void TTaskActorNextEvent::await_suspend(std::coroutine_handle<> h) noexcept { - Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); - TlsCurrentTaskActor->WaitForEvent(h); - } - - std::unique_ptr<IEventHandle> TTaskActorNextEvent::await_resume() { - Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); - return TlsCurrentTaskActor->FinishWaitForEvent(); - } - - IActor* TTaskActor::Create(TTask<void>&& task) { - return new TTaskActorImpl(std::move(task)); - } - - TActorIdentity TTaskActor::SelfId() noexcept { - Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); - return TlsCurrentTaskActor->SelfId(); - } - - TActorId TTaskActor::ParentId() noexcept { - Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); - return TlsCurrentTaskActor->ParentId; - } - - void TAfterAwaiter::await_suspend(std::coroutine_handle<> h) noexcept { - Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); - TlsCurrentTaskActor->Schedule(Duration, new TEvResumeTask(h, &Result)); - } - - bool TBindAwaiter::await_ready() noexcept { - if (TlsCurrentTaskActor && TlsCurrentTaskActor->SelfId() == ActorId) { - return true; - } - return false; - } - - void TBindAwaiter::await_suspend(std::coroutine_handle<> h) noexcept { - Sys->Send(new IEventHandle(ActorId, ActorId, new TEvResumeTask(h, &Result))); - } - -} // namespace NActors diff --git a/library/cpp/actors/cppcoro/task_actor.h b/library/cpp/actors/cppcoro/task_actor.h deleted file mode 100644 index 75d498a04e..0000000000 --- a/library/cpp/actors/cppcoro/task_actor.h +++ /dev/null @@ -1,107 +0,0 @@ -#include <library/cpp/actors/core/actor.h> -#include "task.h" - -namespace NActors { - - struct TTaskActorNextEvent { - static constexpr bool await_ready() noexcept { return false; } - - static void await_suspend(std::coroutine_handle<> h) noexcept; - - static std::unique_ptr<IEventHandle> await_resume(); - }; - - class TAfterAwaiter { - public: - TAfterAwaiter(TDuration duration) - : Duration(duration) - {} - - static constexpr bool await_ready() noexcept { return false; } - - void await_suspend(std::coroutine_handle<> h) noexcept; - - void await_resume() { - Result.Value(); - } - - private: - TDuration Duration; - TTaskResult<void> Result; - }; - - class TBindAwaiter { - public: - TBindAwaiter(TActorSystem* sys, const TActorId& actorId) - : Sys(sys) - , ActorId(actorId) - {} - - bool await_ready() noexcept; - - void await_suspend(std::coroutine_handle<> h) noexcept; - - void await_resume() { - Result.Value(); - } - - private: - TActorSystem* Sys; - TActorId ActorId; - TTaskResult<void> Result; - }; - - class TTaskActor { - public: - /** - * Creates a new actor that will run the specified task. - */ - static IActor* Create(TTask<void>&& task); - - /** - * Returns the next actor event when awaited - */ - static constexpr TTaskActorNextEvent NextEvent{}; - - /** - * Returns the identity of current task actor. - */ - static TActorIdentity SelfId() noexcept; - - /** - * Returns an actor id of the actor that registered current task actor. - */ - static TActorId ParentId() noexcept; - - /** - * Returns awaiter that completes after the specified timeout. - */ - static TAfterAwaiter After(TDuration duration) noexcept { - return TAfterAwaiter{ duration }; - } - - /** - * Returns awaiter that completes on actor thread when awaited. - */ - static TBindAwaiter Bind() noexcept { - TActorId actorId = SelfId(); - TActorSystem* sys = TActivationContext::ActorSystem(); - return TBindAwaiter{ sys, actorId }; - } - - /** - * Returns a task that runs the specified task, but binds the result - * back to the actor thread. Useful when the specified task may be - * working with non-actor coroutines. - */ - template<class T> - static TTask<T> Bind(TTask<T>&& task) { - return [](TTask<T> task, TBindAwaiter bindTask) -> TTask<T> { - auto result = co_await std::move(task).WhenDone(); - co_await bindTask; - co_return std::move(result).Value(); - }(std::move(task), Bind()); - } - }; - -} // namespace NActors diff --git a/library/cpp/actors/cppcoro/task_actor_ut.cpp b/library/cpp/actors/cppcoro/task_actor_ut.cpp deleted file mode 100644 index 43186bfc55..0000000000 --- a/library/cpp/actors/cppcoro/task_actor_ut.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "task_actor.h" -#include <library/cpp/actors/core/executor_pool_basic.h> -#include <library/cpp/actors/core/scheduler_basic.h> - -#include <library/cpp/testing/unittest/registar.h> - -Y_UNIT_TEST_SUITE(TaskActor) { - - using namespace NActors; - - enum : ui32 { - EvBegin = EventSpaceBegin(TEvents::ES_USERSPACE), - EvRequest, - EvResponse, - EvStop, - }; - - struct TEvRequest: public TEventLocal<TEvRequest, EvRequest> { - }; - - struct TEvResponse: public TEventLocal<TEvResponse, EvResponse> { - }; - - struct TEvStop: public TEventLocal<TEvStop, EvStop> { - }; - - TTask<void> SimpleResponder() { - for (;;) { - auto ev = co_await TTaskActor::NextEvent; - Y_ABORT_UNLESS(ev->GetTypeRewrite() == TEvRequest::EventType); - auto* msg = ev->Get<TEvRequest>(); - Y_UNUSED(msg); - TTaskActor::SelfId().Send(ev->Sender, new TEvResponse); - } - } - - TTask<void> SimpleRequester(TActorId responder, TManualEvent& doneEvent, std::atomic<int>& itemsProcessed) { - // Note: it's ok to use lambda capture because captures outlive this coroutine - auto singleRequest = [&]() -> TTask<bool> { - TTaskActor::SelfId().Send(responder, new TEvRequest); - auto ev = co_await TTaskActor::NextEvent; - switch (ev->GetTypeRewrite()) { - case TEvResponse::EventType: - co_return true; - case TEvStop::EventType: - co_return false; - default: - Y_ABORT("Unexpected event"); - } - }; - while (co_await singleRequest()) { - ++itemsProcessed; - } - doneEvent.Signal(); - } - - void Check(TDuration duration, std::unique_ptr<IEventBase> stopEvent) { - THolder<TActorSystemSetup> setup = MakeHolder<TActorSystemSetup>(); - setup->NodeId = 0; - setup->ExecutorsCount = 1; - setup->Executors.Reset(new TAutoPtr<IExecutorPool>[setup->ExecutorsCount]); - for (ui32 i = 0; i < setup->ExecutorsCount; ++i) { - setup->Executors[i] = new TBasicExecutorPool(i, 5, 10, "basic"); - } - setup->Scheduler = new TBasicSchedulerThread; - - TActorSystem actorSystem(setup); - - actorSystem.Start(); - - TManualEvent doneEvent; - std::atomic<int> itemsProcessed{0}; - - auto responder = actorSystem.Register(TTaskActor::Create(SimpleResponder())); - auto requester = actorSystem.Register(TTaskActor::Create(SimpleRequester(responder, doneEvent, itemsProcessed))); - auto deadline = TMonotonic::Now() + duration; - while (itemsProcessed.load() < 10) { - UNIT_ASSERT_C(TMonotonic::Now() < deadline, "cannot observe 10 responses in " << duration); - Sleep(TDuration::MilliSeconds(100)); - } - actorSystem.Send(requester, stopEvent.release()); - doneEvent.WaitI(); - - UNIT_ASSERT_GE(itemsProcessed.load(), 10); - - actorSystem.Stop(); - } - - Y_UNIT_TEST(Basic) { - Check(TDuration::Seconds(10), std::make_unique<TEvStop>()); - } - -} // Y_UNIT_TEST_SUITE(TaskActor) diff --git a/library/cpp/actors/cppcoro/task_group.cpp b/library/cpp/actors/cppcoro/task_group.cpp deleted file mode 100644 index 9ddd30d707..0000000000 --- a/library/cpp/actors/cppcoro/task_group.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "task_group.h" diff --git a/library/cpp/actors/cppcoro/task_group.h b/library/cpp/actors/cppcoro/task_group.h deleted file mode 100644 index 1de0cf5c1e..0000000000 --- a/library/cpp/actors/cppcoro/task_group.h +++ /dev/null @@ -1,302 +0,0 @@ -#pragma once -#include "task_result.h" -#include <util/generic/ptr.h> -#include <util/system/compiler.h> -#include <util/system/yassert.h> -#include <coroutine> -#include <atomic> -#include <memory> - -namespace NActors { - - namespace NDetail { - - template<class T> - struct TTaskGroupResult final : public TTaskResult<T> { - TTaskGroupResult* Next; - }; - - template<class T> - struct TTaskGroupSink final - : public TAtomicRefCount<TTaskGroupSink<T>> - { - std::atomic<void*> LastReady{ nullptr }; - TTaskGroupResult<T>* ReadyQueue = nullptr; - std::coroutine_handle<> Continuation; - - static constexpr uintptr_t MarkerAwaiting = 1; - static constexpr uintptr_t MarkerDetached = 2; - - ~TTaskGroupSink() noexcept { - if (!IsDetached()) { - Detach(); - } - } - - std::coroutine_handle<> Push(std::unique_ptr<TTaskGroupResult<T>>&& result) noexcept { - void* currentValue = LastReady.load(std::memory_order_acquire); - for (;;) { - if (currentValue == (void*)MarkerAwaiting) { - if (Y_UNLIKELY(!LastReady.compare_exchange_weak(currentValue, nullptr, std::memory_order_acquire))) { - continue; - } - // We consume the awaiter - Y_DEBUG_ABORT_UNLESS(ReadyQueue == nullptr, "TaskGroup is awaiting with non-empty ready queue"); - result->Next = ReadyQueue; - ReadyQueue = result.release(); - return std::exchange(Continuation, {}); - } - if (currentValue == (void*)MarkerDetached) { - // Task group is detached, discard the result - return std::noop_coroutine(); - } - TTaskGroupResult<T>* current = reinterpret_cast<TTaskGroupResult<T>*>(currentValue); - result->Next = current; - void* nextValue = result.get(); - if (Y_LIKELY(LastReady.compare_exchange_weak(currentValue, nextValue, std::memory_order_acq_rel))) { - // Result successfully added - result.release(); - return std::noop_coroutine(); - } - } - } - - bool Ready() const noexcept { - return ReadyQueue != nullptr || LastReady.load(std::memory_order_acquire) != nullptr; - } - - Y_NO_INLINE std::coroutine_handle<> Suspend(std::coroutine_handle<> h) noexcept { - Y_DEBUG_ABORT_UNLESS(ReadyQueue == nullptr, "Caller suspending with non-empty ready queue"); - Continuation = h; - void* currentValue = LastReady.load(std::memory_order_acquire); - for (;;) { - if (currentValue == nullptr) { - if (Y_UNLIKELY(!LastReady.compare_exchange_weak(currentValue, (void*)MarkerAwaiting, std::memory_order_release))) { - continue; - } - // Continuation may wake up on another thread - return std::noop_coroutine(); - } - Y_ABORT_UNLESS(currentValue != (void*)MarkerAwaiting, "TaskGroup is suspending with an awaiting marker"); - Y_ABORT_UNLESS(currentValue != (void*)MarkerDetached, "TaskGroup is suspending with a detached marker"); - // Race: ready queue is not actually empty - Continuation = {}; - return h; - } - } - - std::unique_ptr<TTaskGroupResult<T>> Resume() noexcept { - std::unique_ptr<TTaskGroupResult<T>> result; - if (ReadyQueue == nullptr) { - void* headValue = LastReady.exchange(nullptr, std::memory_order_acq_rel); - Y_ABORT_UNLESS(headValue != (void*)MarkerAwaiting, "TaskGroup is resuming with an awaiting marker"); - Y_ABORT_UNLESS(headValue != (void*)MarkerDetached, "TaskGroup is resuming with a detached marker"); - Y_ABORT_UNLESS(headValue, "TaskGroup is resuming with an empty queue"); - TTaskGroupResult<T>* head = reinterpret_cast<TTaskGroupResult<T>*>(headValue); - while (head) { - auto* next = std::exchange(head->Next, nullptr); - head->Next = ReadyQueue; - ReadyQueue = head; - head = next; - } - } - Y_ABORT_UNLESS(ReadyQueue != nullptr); - result.reset(ReadyQueue); - ReadyQueue = std::exchange(result->Next, nullptr); - return result; - } - - static void Dispose(TTaskGroupResult<T>* head) noexcept { - while (head) { - auto* next = std::exchange(head->Next, nullptr); - std::unique_ptr<TTaskGroupResult<T>> ptr(head); - head = next; - } - } - - bool IsDetached() const noexcept { - void* headValue = LastReady.load(std::memory_order_acquire); - return headValue == (void*)MarkerDetached; - } - - void Detach() noexcept { - // After this exchange all new results will be discarded - void* headValue = LastReady.exchange((void*)MarkerDetached, std::memory_order_acq_rel); - Y_ABORT_UNLESS(headValue != (void*)MarkerAwaiting, "TaskGroup is detaching with an awaiting marker"); - Y_ABORT_UNLESS(headValue != (void*)MarkerDetached, "TaskGroup is detaching with a detached marker"); - if (headValue) { - Dispose(reinterpret_cast<TTaskGroupResult<T>*>(headValue)); - } - if (ReadyQueue) { - Dispose(std::exchange(ReadyQueue, nullptr)); - } - } - }; - - template<class T> - class TTaskGroupResultHandler { - public: - void unhandled_exception() noexcept { - Result->SetException(std::current_exception()); - } - - template<class TResult> - void return_value(TResult&& result) { - Result->SetValue(std::forward<TResult>(result)); - } - - protected: - std::unique_ptr<TTaskGroupResult<T>> Result = std::make_unique<TTaskGroupResult<T>>(); - }; - - template<> - class TTaskGroupResultHandler<void> { - public: - void unhandled_exception() noexcept { - Result->SetException(std::current_exception()); - } - - void return_void() noexcept { - Result->SetValue(); - } - - protected: - std::unique_ptr<TTaskGroupResult<void>> Result = std::make_unique<TTaskGroupResult<void>>(); - }; - - template<class T> - class TTaskGroupPromise final : public TTaskGroupResultHandler<T> { - public: - using THandle = std::coroutine_handle<TTaskGroupPromise<T>>; - - THandle get_return_object() noexcept { - return THandle::from_promise(*this); - } - - static auto initial_suspend() noexcept { return std::suspend_always{}; } - - struct TFinalSuspend { - static bool await_ready() noexcept { return false; } - static void await_resume() noexcept { Y_ABORT("unexpected coroutine resume"); } - - Y_NO_INLINE - static std::coroutine_handle<> await_suspend(std::coroutine_handle<TTaskGroupPromise<T>> h) noexcept { - auto& promise = h.promise(); - auto sink = std::move(promise.Sink); - auto next = sink->Push(std::move(promise.Result)); - h.destroy(); - return next; - } - }; - - static auto final_suspend() noexcept { return TFinalSuspend{}; } - - void SetSink(const TIntrusivePtr<TTaskGroupSink<T>>& sink) { - Sink = sink; - } - - private: - TIntrusivePtr<TTaskGroupSink<T>> Sink; - }; - - template<class T> - class TTaskGroupTask final { - public: - using THandle = std::coroutine_handle<TTaskGroupPromise<T>>; - using promise_type = TTaskGroupPromise<T>; - using value_type = T; - - public: - TTaskGroupTask(THandle handle) - : Handle(handle) - {} - - void Start(const TIntrusivePtr<TTaskGroupSink<T>>& sink) { - Handle.promise().SetSink(sink); - Handle.resume(); - } - - private: - THandle Handle; - }; - - template<class T, class TAwaitable> - TTaskGroupTask<T> CreateTaskGroupTask(TAwaitable awaitable) { - co_return co_await std::move(awaitable); - } - - } // namespace NDetail - - /** - * A task group allows starting multiple subtasks of the same result type - * and awaiting them in a structured way. When task group is destroyed - * all subtasks are detached in a thread-safe way. - */ - template<class T> - class TTaskGroup { - public: - TTaskGroup() = default; - - TTaskGroup(const TTaskGroup&) = delete; - TTaskGroup(TTaskGroup&&) = delete; - TTaskGroup& operator=(const TTaskGroup&) = delete; - TTaskGroup& operator=(TTaskGroup&&) = delete; - - ~TTaskGroup() { - Sink_->Detach(); - } - - /** - * Add task to the group that will await the result of awaitable - */ - template<class TAwaitable> - void AddTask(TAwaitable&& awaitable) { - auto task = NDetail::CreateTaskGroupTask<T>(std::forward<TAwaitable>(awaitable)); - task.Start(Sink_); - ++TaskCount_; - } - - /** - * Returns the number of tasks left unawaited - */ - size_t TaskCount() const { - return TaskCount_; - } - - class TAwaiter { - public: - explicit TAwaiter(TTaskGroup& taskGroup) noexcept - : TaskGroup_(taskGroup) - {} - - bool await_ready() const noexcept { - Y_ABORT_UNLESS(TaskGroup_.TaskCount_ > 0, "Not enough tasks to await"); - --TaskGroup_.TaskCount_; - return TaskGroup_.Sink_->Ready(); - } - - std::coroutine_handle<> await_suspend(std::coroutine_handle<> h) noexcept { - return TaskGroup_.Sink_->Suspend(h); - } - - T await_resume() { - return std::move(*TaskGroup_.Sink_->Resume()).Value(); - } - - private: - TTaskGroup& TaskGroup_; - }; - - /** - * Await result of the next task in the task group - */ - TAwaiter operator co_await() noexcept { - return TAwaiter(*this); - } - - private: - TIntrusivePtr<NDetail::TTaskGroupSink<T>> Sink_ = MakeIntrusive<NDetail::TTaskGroupSink<T>>(); - size_t TaskCount_ = 0; - }; - -} // namespace NActors diff --git a/library/cpp/actors/cppcoro/task_result.cpp b/library/cpp/actors/cppcoro/task_result.cpp deleted file mode 100644 index bb1a1dc5ca..0000000000 --- a/library/cpp/actors/cppcoro/task_result.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "task_result.h" diff --git a/library/cpp/actors/cppcoro/task_result.h b/library/cpp/actors/cppcoro/task_result.h deleted file mode 100644 index da78c53b7a..0000000000 --- a/library/cpp/actors/cppcoro/task_result.h +++ /dev/null @@ -1,113 +0,0 @@ -#pragma once -#include <util/system/yassert.h> -#include <exception> -#include <variant> - -namespace NActors { - - namespace NDetail { - - struct TVoid {}; - - template<class T> - struct TReplaceVoid { - using TType = T; - }; - - template<> - struct TReplaceVoid<void> { - using TType = TVoid; - }; - - template<class T> - struct TLValue { - using TType = T&; - }; - - template<> - struct TLValue<void> { - using TType = void; - }; - - template<class T> - struct TRValue { - using TType = T&&; - }; - - template<> - struct TRValue<void> { - using TType = void; - }; - - } // namespace NDetail - - /** - * Wrapper for the task result - */ - template<class T> - class TTaskResult { - public: - void SetValue() - requires (std::same_as<T, void>) - { - Result.template emplace<1>(); - } - - template<class TResult> - void SetValue(TResult&& result) - requires (!std::same_as<T, void>) - { - Result.template emplace<1>(std::forward<TResult>(result)); - } - - void SetException(std::exception_ptr&& e) noexcept { - Result.template emplace<2>(std::move(e)); - } - - typename NDetail::TLValue<T>::TType Value() & { - switch (Result.index()) { - case 0: { - Y_ABORT("Task result has no value"); - } - case 1: { - if constexpr (std::same_as<T, void>) { - return; - } else { - return std::get<1>(Result); - } - } - case 2: { - std::exception_ptr& e = std::get<2>(Result); - Y_DEBUG_ABORT_UNLESS(e, "Task exception missing"); - std::rethrow_exception(e); - } - } - Y_ABORT("Task result has an invalid state"); - } - - typename NDetail::TRValue<T>::TType Value() && { - switch (Result.index()) { - case 0: { - Y_ABORT("Task result has no value"); - } - case 1: { - if constexpr (std::same_as<T, void>) { - return; - } else { - return std::get<1>(std::move(Result)); - } - } - case 2: { - std::exception_ptr& e = std::get<2>(Result); - Y_DEBUG_ABORT_UNLESS(e, "Task exception missing"); - std::rethrow_exception(std::move(e)); - } - } - Y_ABORT("Task result has an invalid state"); - } - - private: - std::variant<std::monostate, typename NDetail::TReplaceVoid<T>::TType, std::exception_ptr> Result; - }; - -} // namespace NActors diff --git a/library/cpp/actors/cppcoro/task_ut.cpp b/library/cpp/actors/cppcoro/task_ut.cpp deleted file mode 100644 index a1ed5426fc..0000000000 --- a/library/cpp/actors/cppcoro/task_ut.cpp +++ /dev/null @@ -1,263 +0,0 @@ -#include "task.h" -#include "task_group.h" -#include "await_callback.h" -#include <library/cpp/testing/unittest/registar.h> - -using namespace NActors; - -Y_UNIT_TEST_SUITE(Task) { - - TTask<void> SimpleReturnVoid() { - co_return; - } - - TTask<int> SimpleReturn42() { - co_return 42; - } - - Y_UNIT_TEST(SimpleVoidCoroutine) { - bool finished = false; - AwaitThenCallback(SimpleReturnVoid(), [&]() { - finished = true; - }); - UNIT_ASSERT(finished); - } - - Y_UNIT_TEST(SimpleIntCoroutine) { - std::optional<int> result; - AwaitThenCallback(SimpleReturn42(), [&](int value) { - result = value; - }); - UNIT_ASSERT(result); - UNIT_ASSERT_VALUES_EQUAL(*result, 42); - } - - Y_UNIT_TEST(SimpleVoidWhenDone) { - std::optional<TTaskResult<void>> result; - AwaitThenCallback(SimpleReturnVoid().WhenDone(), [&](auto value) { - result = std::move(value); - }); - UNIT_ASSERT(result); - result->Value(); - } - - Y_UNIT_TEST(SimpleIntWhenDone) { - std::optional<TTaskResult<int>> result; - AwaitThenCallback(SimpleReturn42().WhenDone(), [&](auto value) { - result = std::move(value); - }); - UNIT_ASSERT(result); - UNIT_ASSERT_VALUES_EQUAL(result->Value(), 42); - } - - template<class TCallback> - TTask<int> CallTwice(TCallback callback) { - int a = co_await callback(); - int b = co_await callback(); - co_return a + b; - } - - Y_UNIT_TEST(NestedAwait) { - auto task = CallTwice([]{ - return SimpleReturn42(); - }); - UNIT_ASSERT(task); - std::optional<int> result; - AwaitThenCallback(std::move(task), [&](int value) { - result = value; - }); - UNIT_ASSERT(result); - UNIT_ASSERT_VALUES_EQUAL(*result, 84); - } - - template<class T> - struct TPauseState { - std::coroutine_handle<> Next; - std::optional<T> NextResult; - - ~TPauseState() { - while (Next) { - NextResult.reset(); - std::exchange(Next, {}).resume(); - } - } - - struct TAwaiter { - TPauseState* State; - - bool await_ready() const noexcept { return false; } - void await_suspend(std::coroutine_handle<> c) const noexcept { - State->Next = c; - } - T await_resume() const { - if (!State->NextResult) { - throw TTaskCancelled(); - } else { - T result = std::move(*State->NextResult); - State->NextResult.reset(); - return result; - } - } - }; - - auto Wait() { - return TAwaiter{ this }; - } - - explicit operator bool() const { - return bool(Next); - } - - void Resume(T result) { - Y_ABORT_UNLESS(Next && !Next.done()); - NextResult = result; - std::exchange(Next, {}).resume(); - } - - void Cancel() { - Y_ABORT_UNLESS(Next && !Next.done()); - NextResult.reset(); - std::exchange(Next, {}).resume(); - } - }; - - Y_UNIT_TEST(PauseResume) { - TPauseState<int> state; - auto task = CallTwice([&]{ - return state.Wait(); - }); - std::optional<int> result; - AwaitThenCallback(std::move(task), [&](int value) { - result = value; - }); - UNIT_ASSERT(!result); - UNIT_ASSERT(state); - state.Resume(11); - UNIT_ASSERT(!result); - UNIT_ASSERT(state); - state.Resume(22); - UNIT_ASSERT(result); - UNIT_ASSERT_VALUES_EQUAL(*result, 33); - } - - Y_UNIT_TEST(PauseCancel) { - TPauseState<int> state; - auto task = CallTwice([&]{ - return state.Wait(); - }); - std::optional<int> result; - AwaitThenCallback(std::move(task).WhenDone(), [&](TTaskResult<int>&& value) { - try { - result = value.Value(); - } catch (TTaskCancelled&) { - // nothing - } - }); - UNIT_ASSERT(!result); - UNIT_ASSERT(state); - state.Resume(11); - UNIT_ASSERT(!result); - UNIT_ASSERT(state); - state.Cancel(); - UNIT_ASSERT(!result); - } - - Y_UNIT_TEST(GroupWithTwoSubTasks) { - TPauseState<int> state1; - TPauseState<int> state2; - - std::vector<int> results; - auto task = [](auto& state1, auto& state2, auto& results) -> TTask<int> { - TTaskGroup<int> group; - group.AddTask(state1.Wait()); - group.AddTask(state2.Wait()); - int a = co_await group; - results.push_back(a); - int b = co_await group; - results.push_back(b); - co_return a + b; - }(state1, state2, results); - - std::optional<int> result; - AwaitThenCallback(std::move(task), [&](int value) { - result = value; - }); - - // We must be waiting for both states - UNIT_ASSERT(state1); - UNIT_ASSERT(state2); - state2.Resume(22); - UNIT_ASSERT_VALUES_EQUAL(results.size(), 1u); - UNIT_ASSERT_VALUES_EQUAL(results.at(0), 22); - UNIT_ASSERT(!result); - state1.Resume(11); - UNIT_ASSERT_VALUES_EQUAL(results.size(), 2u); - UNIT_ASSERT_VALUES_EQUAL(results.at(1), 11); - UNIT_ASSERT(result); - UNIT_ASSERT_VALUES_EQUAL(*result, 33); - } - - Y_UNIT_TEST(GroupWithTwoSubTasksDetached) { - TPauseState<int> state1; - TPauseState<int> state2; - - std::vector<int> results; - auto task = [](auto& state1, auto& state2, auto& results) -> TTask<int> { - TTaskGroup<int> group; - group.AddTask(state1.Wait()); - group.AddTask(state2.Wait()); - int a = co_await group; - results.push_back(a); - co_return a; - }(state1, state2, results); - - std::optional<int> result; - AwaitThenCallback(std::move(task), [&](int value) { - result = value; - }); - - // We must be waiting for both states - UNIT_ASSERT(state1); - UNIT_ASSERT(state2); - state2.Resume(22); - UNIT_ASSERT_VALUES_EQUAL(results.size(), 1u); - UNIT_ASSERT_VALUES_EQUAL(results.at(0), 22); - UNIT_ASSERT(result); - UNIT_ASSERT_VALUES_EQUAL(*result, 22); - } - - Y_UNIT_TEST(GroupWithTwoSubTasksOneCancelled) { - TPauseState<int> state1; - TPauseState<int> state2; - std::vector<int> results; - auto task = [](auto& state1, auto& state2, auto& results) -> TTask<void> { - TTaskGroup<int> group; - group.AddTask(state1.Wait()); - group.AddTask(state2.Wait()); - for (int i = 0; i < 2; ++i) { - try { - results.push_back(co_await group); - } catch (TTaskCancelled&) { - results.push_back(-1); - } - } - }(state1, state2, results); - - bool finished = false; - AwaitThenCallback(std::move(task), [&]() { - finished = true; - }); - - UNIT_ASSERT(state1); - UNIT_ASSERT(state2); - state2.Cancel(); - UNIT_ASSERT_VALUES_EQUAL(results.size(), 1u); - UNIT_ASSERT_VALUES_EQUAL(results.at(0), -1); - UNIT_ASSERT(!finished); - state1.Resume(11); - UNIT_ASSERT_VALUES_EQUAL(results.size(), 2u); - UNIT_ASSERT_VALUES_EQUAL(results.at(1), 11); - UNIT_ASSERT(finished); - } - -} // Y_UNIT_TEST_SUITE(Task) diff --git a/library/cpp/actors/cppcoro/ut/CMakeLists.darwin-arm64.txt b/library/cpp/actors/cppcoro/ut/CMakeLists.darwin-arm64.txt deleted file mode 100644 index 5ec40dbae9..0000000000 --- a/library/cpp/actors/cppcoro/ut/CMakeLists.darwin-arm64.txt +++ /dev/null @@ -1,68 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(library-cpp-actors-cppcoro-ut) -target_include_directories(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro -) -target_link_libraries(library-cpp-actors-cppcoro-ut PUBLIC - contrib-libs-cxxsupp - yutil - cpp-testing-unittest_main - cpp-actors-cppcoro - cpp-actors-testlib -) -target_link_options(library-cpp-actors-cppcoro-ut PRIVATE - -Wl,-platform_version,macos,11.0,11.0 - -fPIC - -fPIC - -framework - CoreFoundation -) -target_sources(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_ut.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor_ut.cpp -) -set_property( - TARGET - library-cpp-actors-cppcoro-ut - PROPERTY - SPLIT_FACTOR - 1 -) -add_yunittest( - NAME - library-cpp-actors-cppcoro-ut - TEST_TARGET - library-cpp-actors-cppcoro-ut - TEST_ARG - --print-before-suite - --print-before-test - --fork-tests - --print-times - --show-fails -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - LABELS - SMALL -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - PROCESSORS - 1 -) -target_allocator(library-cpp-actors-cppcoro-ut - system_allocator -) -vcs_info(library-cpp-actors-cppcoro-ut) diff --git a/library/cpp/actors/cppcoro/ut/CMakeLists.darwin-x86_64.txt b/library/cpp/actors/cppcoro/ut/CMakeLists.darwin-x86_64.txt deleted file mode 100644 index 7cebff01de..0000000000 --- a/library/cpp/actors/cppcoro/ut/CMakeLists.darwin-x86_64.txt +++ /dev/null @@ -1,69 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(library-cpp-actors-cppcoro-ut) -target_include_directories(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro -) -target_link_libraries(library-cpp-actors-cppcoro-ut PUBLIC - contrib-libs-cxxsupp - yutil - library-cpp-cpuid_check - cpp-testing-unittest_main - cpp-actors-cppcoro - cpp-actors-testlib -) -target_link_options(library-cpp-actors-cppcoro-ut PRIVATE - -Wl,-platform_version,macos,11.0,11.0 - -fPIC - -fPIC - -framework - CoreFoundation -) -target_sources(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_ut.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor_ut.cpp -) -set_property( - TARGET - library-cpp-actors-cppcoro-ut - PROPERTY - SPLIT_FACTOR - 1 -) -add_yunittest( - NAME - library-cpp-actors-cppcoro-ut - TEST_TARGET - library-cpp-actors-cppcoro-ut - TEST_ARG - --print-before-suite - --print-before-test - --fork-tests - --print-times - --show-fails -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - LABELS - SMALL -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - PROCESSORS - 1 -) -target_allocator(library-cpp-actors-cppcoro-ut - system_allocator -) -vcs_info(library-cpp-actors-cppcoro-ut) diff --git a/library/cpp/actors/cppcoro/ut/CMakeLists.linux-aarch64.txt b/library/cpp/actors/cppcoro/ut/CMakeLists.linux-aarch64.txt deleted file mode 100644 index 4a11af3456..0000000000 --- a/library/cpp/actors/cppcoro/ut/CMakeLists.linux-aarch64.txt +++ /dev/null @@ -1,72 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(library-cpp-actors-cppcoro-ut) -target_include_directories(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro -) -target_link_libraries(library-cpp-actors-cppcoro-ut PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - cpp-testing-unittest_main - cpp-actors-cppcoro - cpp-actors-testlib -) -target_link_options(library-cpp-actors-cppcoro-ut PRIVATE - -ldl - -lrt - -Wl,--no-as-needed - -fPIC - -fPIC - -lpthread - -lrt - -ldl -) -target_sources(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_ut.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor_ut.cpp -) -set_property( - TARGET - library-cpp-actors-cppcoro-ut - PROPERTY - SPLIT_FACTOR - 1 -) -add_yunittest( - NAME - library-cpp-actors-cppcoro-ut - TEST_TARGET - library-cpp-actors-cppcoro-ut - TEST_ARG - --print-before-suite - --print-before-test - --fork-tests - --print-times - --show-fails -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - LABELS - SMALL -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - PROCESSORS - 1 -) -target_allocator(library-cpp-actors-cppcoro-ut - cpp-malloc-jemalloc -) -vcs_info(library-cpp-actors-cppcoro-ut) diff --git a/library/cpp/actors/cppcoro/ut/CMakeLists.linux-x86_64.txt b/library/cpp/actors/cppcoro/ut/CMakeLists.linux-x86_64.txt deleted file mode 100644 index 2e2412f989..0000000000 --- a/library/cpp/actors/cppcoro/ut/CMakeLists.linux-x86_64.txt +++ /dev/null @@ -1,74 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(library-cpp-actors-cppcoro-ut) -target_include_directories(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro -) -target_link_libraries(library-cpp-actors-cppcoro-ut PUBLIC - contrib-libs-linux-headers - contrib-libs-cxxsupp - yutil - library-cpp-cpuid_check - cpp-testing-unittest_main - cpp-actors-cppcoro - cpp-actors-testlib -) -target_link_options(library-cpp-actors-cppcoro-ut PRIVATE - -ldl - -lrt - -Wl,--no-as-needed - -fPIC - -fPIC - -lpthread - -lrt - -ldl -) -target_sources(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_ut.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor_ut.cpp -) -set_property( - TARGET - library-cpp-actors-cppcoro-ut - PROPERTY - SPLIT_FACTOR - 1 -) -add_yunittest( - NAME - library-cpp-actors-cppcoro-ut - TEST_TARGET - library-cpp-actors-cppcoro-ut - TEST_ARG - --print-before-suite - --print-before-test - --fork-tests - --print-times - --show-fails -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - LABELS - SMALL -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - PROCESSORS - 1 -) -target_allocator(library-cpp-actors-cppcoro-ut - cpp-malloc-tcmalloc - libs-tcmalloc-no_percpu_cache -) -vcs_info(library-cpp-actors-cppcoro-ut) diff --git a/library/cpp/actors/cppcoro/ut/CMakeLists.txt b/library/cpp/actors/cppcoro/ut/CMakeLists.txt deleted file mode 100644 index 2dce3a77fe..0000000000 --- a/library/cpp/actors/cppcoro/ut/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - -if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA) - include(CMakeLists.linux-aarch64.txt) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - include(CMakeLists.darwin-x86_64.txt) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") - include(CMakeLists.darwin-arm64.txt) -elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA) - include(CMakeLists.windows-x86_64.txt) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA) - include(CMakeLists.linux-x86_64.txt) -endif() diff --git a/library/cpp/actors/cppcoro/ut/CMakeLists.windows-x86_64.txt b/library/cpp/actors/cppcoro/ut/CMakeLists.windows-x86_64.txt deleted file mode 100644 index e3b8b019c8..0000000000 --- a/library/cpp/actors/cppcoro/ut/CMakeLists.windows-x86_64.txt +++ /dev/null @@ -1,62 +0,0 @@ - -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. - - - -add_executable(library-cpp-actors-cppcoro-ut) -target_include_directories(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro -) -target_link_libraries(library-cpp-actors-cppcoro-ut PUBLIC - contrib-libs-cxxsupp - yutil - library-cpp-cpuid_check - cpp-testing-unittest_main - cpp-actors-cppcoro - cpp-actors-testlib -) -target_sources(library-cpp-actors-cppcoro-ut PRIVATE - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_ut.cpp - ${CMAKE_SOURCE_DIR}/library/cpp/actors/cppcoro/task_actor_ut.cpp -) -set_property( - TARGET - library-cpp-actors-cppcoro-ut - PROPERTY - SPLIT_FACTOR - 1 -) -add_yunittest( - NAME - library-cpp-actors-cppcoro-ut - TEST_TARGET - library-cpp-actors-cppcoro-ut - TEST_ARG - --print-before-suite - --print-before-test - --fork-tests - --print-times - --show-fails -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - LABELS - SMALL -) -set_yunittest_property( - TEST - library-cpp-actors-cppcoro-ut - PROPERTY - PROCESSORS - 1 -) -target_allocator(library-cpp-actors-cppcoro-ut - system_allocator -) -vcs_info(library-cpp-actors-cppcoro-ut) diff --git a/library/cpp/actors/cppcoro/ut/ya.make b/library/cpp/actors/cppcoro/ut/ya.make deleted file mode 100644 index 24a9c73613..0000000000 --- a/library/cpp/actors/cppcoro/ut/ya.make +++ /dev/null @@ -1,12 +0,0 @@ -UNITTEST_FOR(library/cpp/actors/cppcoro) - -PEERDIR( - library/cpp/actors/testlib -) - -SRCS( - task_ut.cpp - task_actor_ut.cpp -) - -END() diff --git a/library/cpp/actors/cppcoro/ya.make b/library/cpp/actors/cppcoro/ya.make deleted file mode 100644 index 4df4f05302..0000000000 --- a/library/cpp/actors/cppcoro/ya.make +++ /dev/null @@ -1,25 +0,0 @@ -LIBRARY() - -PEERDIR( - library/cpp/actors/core -) - -SRCS( - await_callback.cpp - await_callback.h - task_actor.cpp - task_actor.h - task_group.cpp - task_group.h - task_result.cpp - task_result.h - task.cpp - task.h -) - -END() - -RECURSE_FOR_TESTS( - corobenchmark - ut -) |