Actors: add debug

GitOrigin-RevId: 5278695863219b3645cab477914a690430123c1b
This commit is contained in:
Arseny Smirnov 2019-04-29 21:00:36 +03:00
parent 09569e1fa3
commit f471746973

View File

@ -229,7 +229,8 @@ 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(),
return send_impl<send_type>(
actor_ref.get(),
[&](ActorInfo *actor_info) {
event_context_ptr_->link_token = actor_ref.token();
lambda();
@ -243,7 +244,8 @@ void Scheduler::send_lambda(ActorRef actor_ref, EventT &&lambda) {
template <ActorSendType send_type, class EventT>
void Scheduler::send_closure(ActorRef actor_ref, EventT &&closure) {
return send_impl<send_type>(actor_ref.get(),
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()));
@ -258,7 +260,8 @@ void Scheduler::send_closure(ActorRef actor_ref, EventT &&closure) {
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 send_impl<send_type>(
actor_ref.get(), [&](ActorInfo *actor_info) { do_event(actor_info, std::move(event)); },
[&]() { return std::move(event); });
}
@ -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;
}