Simplify Scheduler::send_impl.
This commit is contained in:
parent
62720bde3c
commit
7a233f25eb
|
@ -108,8 +108,6 @@ class ActorInfo final
|
||||||
bool need_context() const;
|
bool need_context() const;
|
||||||
bool need_start_up() const;
|
bool need_start_up() const;
|
||||||
|
|
||||||
bool must_wait() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Deleter deleter_ = Deleter::None;
|
Deleter deleter_ = Deleter::None;
|
||||||
bool need_context_ = true;
|
bool need_context_ = true;
|
||||||
|
|
|
@ -60,10 +60,6 @@ inline bool ActorInfo::need_start_up() const {
|
||||||
return need_start_up_;
|
return need_start_up_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ActorInfo::must_wait() const {
|
|
||||||
return !mailbox_.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ActorInfo::on_actor_moved(Actor *actor_new_ptr) {
|
inline void ActorInfo::on_actor_moved(Actor *actor_new_ptr) {
|
||||||
actor_ = actor_new_ptr;
|
actor_ = actor_new_ptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,13 +206,9 @@ void Scheduler::send_impl(const ActorId<> &actor_id, const RunFuncT &run_func, c
|
||||||
CHECK(has_guard_ || !on_current_sched);
|
CHECK(has_guard_ || !on_current_sched);
|
||||||
|
|
||||||
if (likely(send_type == ActorSendType::Immediate && on_current_sched && !actor_info->is_running() &&
|
if (likely(send_type == ActorSendType::Immediate && on_current_sched && !actor_info->is_running() &&
|
||||||
!actor_info->must_wait())) { // run immediately
|
actor_info->mailbox_.empty())) { // run immediately
|
||||||
if (likely(actor_info->mailbox_.empty())) {
|
EventGuard guard(this, actor_info);
|
||||||
EventGuard guard(this, actor_info);
|
run_func(actor_info);
|
||||||
run_func(actor_info);
|
|
||||||
} else {
|
|
||||||
flush_mailbox(actor_info, &run_func, &event_func);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (on_current_sched) {
|
if (on_current_sched) {
|
||||||
add_to_mailbox(actor_info, event_func());
|
add_to_mailbox(actor_info, event_func());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user