Actors: add debug
GitOrigin-RevId: 5278695863219b3645cab477914a690430123c1b
This commit is contained in:
parent
09569e1fa3
commit
f471746973
@ -229,37 +229,40 @@ void Scheduler::send_impl(const ActorId<> &actor_id, const RunFuncT &run_func, c
|
||||
|
||||
template <ActorSendType send_type, class EventT>
|
||||
void Scheduler::send_lambda(ActorRef actor_ref, EventT &&lambda) {
|
||||
return send_impl<send_type>(actor_ref.get(),
|
||||
[&](ActorInfo *actor_info) {
|
||||
event_context_ptr_->link_token = actor_ref.token();
|
||||
lambda();
|
||||
},
|
||||
[&]() {
|
||||
auto event = Event::lambda(std::forward<EventT>(lambda));
|
||||
event.set_link_token(actor_ref.token());
|
||||
return std::move(event);
|
||||
});
|
||||
return send_impl<send_type>(
|
||||
actor_ref.get(),
|
||||
[&](ActorInfo *actor_info) {
|
||||
event_context_ptr_->link_token = actor_ref.token();
|
||||
lambda();
|
||||
},
|
||||
[&]() {
|
||||
auto event = Event::lambda(std::forward<EventT>(lambda));
|
||||
event.set_link_token(actor_ref.token());
|
||||
return std::move(event);
|
||||
});
|
||||
}
|
||||
|
||||
template <ActorSendType send_type, class EventT>
|
||||
void Scheduler::send_closure(ActorRef actor_ref, EventT &&closure) {
|
||||
return send_impl<send_type>(actor_ref.get(),
|
||||
[&](ActorInfo *actor_info) {
|
||||
event_context_ptr_->link_token = actor_ref.token();
|
||||
closure.run(static_cast<typename EventT::ActorType *>(actor_info->get_actor_unsafe()));
|
||||
},
|
||||
[&]() {
|
||||
auto event = Event::immediate_closure(std::forward<EventT>(closure));
|
||||
event.set_link_token(actor_ref.token());
|
||||
return std::move(event);
|
||||
});
|
||||
return send_impl<send_type>(
|
||||
actor_ref.get(),
|
||||
[&](ActorInfo *actor_info) {
|
||||
event_context_ptr_->link_token = actor_ref.token();
|
||||
closure.run(static_cast<typename EventT::ActorType *>(actor_info->get_actor_unsafe()));
|
||||
},
|
||||
[&]() {
|
||||
auto event = Event::immediate_closure(std::forward<EventT>(closure));
|
||||
event.set_link_token(actor_ref.token());
|
||||
return std::move(event);
|
||||
});
|
||||
}
|
||||
|
||||
template <ActorSendType send_type>
|
||||
void Scheduler::send(ActorRef actor_ref, Event &&event) {
|
||||
event.set_link_token(actor_ref.token());
|
||||
return send_impl<send_type>(actor_ref.get(), [&](ActorInfo *actor_info) { do_event(actor_info, std::move(event)); },
|
||||
[&]() { return std::move(event); });
|
||||
return send_impl<send_type>(
|
||||
actor_ref.get(), [&](ActorInfo *actor_info) { do_event(actor_info, std::move(event)); },
|
||||
[&]() { return std::move(event); });
|
||||
}
|
||||
|
||||
inline void Scheduler::subscribe(PollableFd fd, PollFlags flags) {
|
||||
@ -293,7 +296,7 @@ inline uint64 Scheduler::get_link_token(Actor *actor) {
|
||||
return get_link_token(actor->get_info());
|
||||
}
|
||||
inline uint64 Scheduler::get_link_token(ActorInfo *actor_info) {
|
||||
CHECK(event_context_ptr_->actor_info == actor_info);
|
||||
LOG_CHECK(event_context_ptr_->actor_info == actor_info) << actor_info->get_name();
|
||||
return event_context_ptr_->link_token;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user