From 992e1144cad15b5623146f627381ab0ae2cfc3cc Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 7 Jan 2020 03:39:44 +0300 Subject: [PATCH] Remove unused Condition class. GitOrigin-RevId: d82bd14425f46cd8b3ddde8ca50db15ed07ff9c9 --- tdactor/CMakeLists.txt | 1 - tdactor/td/actor/Condition.h | 50 ------------------------------------ 2 files changed, 51 deletions(-) delete mode 100644 tdactor/td/actor/Condition.h diff --git a/tdactor/CMakeLists.txt b/tdactor/CMakeLists.txt index 8628954b2..7583c1e5c 100644 --- a/tdactor/CMakeLists.txt +++ b/tdactor/CMakeLists.txt @@ -19,7 +19,6 @@ set(TDACTOR_SOURCE td/actor/impl/Event.h td/actor/impl/Scheduler-decl.h td/actor/impl/Scheduler.h - td/actor/Condition.h td/actor/MultiPromise.h td/actor/PromiseFuture.h td/actor/SchedulerLocalStorage.h diff --git a/tdactor/td/actor/Condition.h b/tdactor/td/actor/Condition.h deleted file mode 100644 index 15ac8abd8..000000000 --- a/tdactor/td/actor/Condition.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020 -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -#pragma once - -#include "td/actor/actor.h" -#include "td/actor/PromiseFuture.h" - -#include "td/utils/common.h" - -namespace td { - -class Condition { - class Helper : public Actor { - public: - void wait(Promise<> promise) { - pending_promises_.push_back(std::move(promise)); - } - - private: - std::vector> pending_promises_; - void tear_down() override { - for (auto &promise : pending_promises_) { - promise.set_value(Unit()); - } - } - }; - - public: - Condition() { - own_actor_ = create_actor("helper"); - actor_ = own_actor_.get(); - } - void wait(Promise<> promise) { - send_closure(actor_, &Helper::wait, std::move(promise)); - } - void set_true() { - CHECK(!own_actor_.empty()); - own_actor_.reset(); - } - - private: - ActorId actor_; - ActorOwn own_actor_; -}; - -} // namespace td