Simplify Scheduler::send_impl.

This commit is contained in:
levlam 2023-01-11 13:27:53 +03:00
parent 62720bde3c
commit 7a233f25eb
3 changed files with 3 additions and 13 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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());