diff options
| author | levlam <levlam@telegram.org> | 2023-01-11 13:27:53 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2023-01-11 13:27:53 +0300 |
| commit | 7a233f25ebd99d90fc46e50c980265b84844fd44 (patch) | |
| tree | 6771b4d6c649287feb6e5cc5ec206debec948435 /tdactor | |
| parent | 62720bde3ccf2f969ea506381ce0dc2d555f3af6 (diff) | |
Simplify Scheduler::send_impl.
Diffstat (limited to 'tdactor')
| -rw-r--r-- | tdactor/td/actor/impl/ActorInfo-decl.h | 2 | ||||
| -rw-r--r-- | tdactor/td/actor/impl/ActorInfo.h | 4 | ||||
| -rw-r--r-- | tdactor/td/actor/impl/Scheduler.h | 10 |
3 files changed, 3 insertions, 13 deletions
diff --git a/tdactor/td/actor/impl/ActorInfo-decl.h b/tdactor/td/actor/impl/ActorInfo-decl.h index 9af073f02..6726c0408 100644 --- a/tdactor/td/actor/impl/ActorInfo-decl.h +++ b/tdactor/td/actor/impl/ActorInfo-decl.h @@ -108,8 +108,6 @@ class ActorInfo final bool need_context() const; bool need_start_up() const; - bool must_wait() const; - private: Deleter deleter_ = Deleter::None; bool need_context_ = true; diff --git a/tdactor/td/actor/impl/ActorInfo.h b/tdactor/td/actor/impl/ActorInfo.h index 16e1cfe77..f734f4c0b 100644 --- a/tdactor/td/actor/impl/ActorInfo.h +++ b/tdactor/td/actor/impl/ActorInfo.h @@ -60,10 +60,6 @@ inline bool ActorInfo::need_start_up() const { return need_start_up_; } -inline bool ActorInfo::must_wait() const { - return !mailbox_.empty(); -} - inline void ActorInfo::on_actor_moved(Actor *actor_new_ptr) { actor_ = actor_new_ptr; } diff --git a/tdactor/td/actor/impl/Scheduler.h b/tdactor/td/actor/impl/Scheduler.h index 298c3a05c..e41e31374 100644 --- a/tdactor/td/actor/impl/Scheduler.h +++ b/tdactor/td/actor/impl/Scheduler.h @@ -206,13 +206,9 @@ void Scheduler::send_impl(const ActorId<> &actor_id, const RunFuncT &run_func, c CHECK(has_guard_ || !on_current_sched); if (likely(send_type == ActorSendType::Immediate && on_current_sched && !actor_info->is_running() && - !actor_info->must_wait())) { // run immediately - if (likely(actor_info->mailbox_.empty())) { - EventGuard guard(this, actor_info); - run_func(actor_info); - } else { - flush_mailbox(actor_info, &run_func, &event_func); - } + actor_info->mailbox_.empty())) { // run immediately + EventGuard guard(this, actor_info); + run_func(actor_info); } else { if (on_current_sched) { add_to_mailbox(actor_info, event_func()); |
