copied_ = true;
}
-ActivityImplPtr CommImpl::isend(const actor::CommIsendSimcall* observer)
+ActivityImplPtr CommImpl::isend(actor::CommIsendSimcall* observer)
{
auto* mbox = observer->get_mailbox();
XBT_DEBUG("send from mailbox %p", mbox);
other_comm->set_state(State::READY);
}
+ observer->set_comm(other_comm.get());
if (observer->is_detached()) {
other_comm->detach();
return (observer->is_detached() ? nullptr : other_comm);
}
-ActivityImplPtr CommImpl::irecv(const actor::CommIrecvSimcall* observer)
+ActivityImplPtr CommImpl::irecv(actor::CommIrecvSimcall* observer)
{
CommImplPtr this_synchro(new CommImpl(CommImpl::Type::RECEIVE));
auto* mbox = observer->get_mailbox();
}
observer->get_issuer()->activities_.emplace_back(other_comm);
}
+ observer->set_comm(other_comm.get());
/* Setup communication synchro */
other_comm->dst_actor_ = observer->get_issuer();
std::vector<s4u::Link*> get_traversed_links() const;
void copy_data();
- static ActivityImplPtr isend(const actor::CommIsendSimcall* observer);
- static ActivityImplPtr irecv(const actor::CommIrecvSimcall* observer);
+ static ActivityImplPtr isend(actor::CommIsendSimcall* observer);
+ static ActivityImplPtr irecv(actor::CommIrecvSimcall* observer);
bool test(actor::ActorImpl* issuer) override;
void wait_for(actor::ActorImpl* issuer, double timeout) override;
void CommIsendSimcall::serialize(std::stringstream& stream) const
{
stream << (short)mc::Transition::Type::COMM_SEND << ' ';
- stream << mbox_->get_id() << ' ' << (void*)src_buff_ << ' ' << src_buff_size_;
+ stream << (void*)comm_ << ' ' << mbox_->get_id() << ' ' << (void*)src_buff_ << ' ' << src_buff_size_;
XBT_DEBUG("SendObserver mbox:%u buff:%p size:%zu", mbox_->get_id(), src_buff_, src_buff_size_);
}
void CommIrecvSimcall::serialize(std::stringstream& stream) const
{
stream << (short)mc::Transition::Type::COMM_RECV << ' ';
- stream << mbox_->get_id() << ' ' << (void*)dst_buff_;
+ stream << (void*)comm_ << ' ' << mbox_->get_id() << ' ' << (void*)dst_buff_;
}
} // namespace actor
size_t src_buff_size_;
void* payload_;
bool detached_;
+ activity::CommImpl* comm_;
bool (*match_fun_)(void*, void*, activity::CommImpl*);
void (*clean_fun_)(void*); // used to free the synchro in case of problem after a detached send
size_t get_src_buff_size() const { return src_buff_size_; }
void* get_payload() const { return payload_; }
bool is_detached() const { return detached_; }
+ void set_comm(activity::CommImpl* comm) { comm_ = comm; }
auto get_match_fun() const { return match_fun_; }
auto get_clean_fun() const { return clean_fun_; }
size_t* dst_buff_size_;
void* payload_;
double rate_;
+ activity::CommImpl* comm_;
bool (*match_fun_)(void*, void*, activity::CommImpl*);
void (*copy_data_fun_)(activity::CommImpl*, void*, size_t); // used to copy data if not default one
unsigned char* get_dst_buff() const { return dst_buff_; }
size_t* get_dst_buff_size() const { return dst_buff_size_; }
void* get_payload() const { return payload_; }
+ void set_comm(activity::CommImpl* comm) { comm_ = comm; }
auto get_match_fun() const { return match_fun_; };
auto get_copy_data_fun() const { return copy_data_fun_; }
CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, std::stringstream& stream)
: Transition(Type::COMM_RECV, issuer, times_considered)
{
- xbt_assert(stream >> mbox_ >> dst_buff_);
+ xbt_assert(stream >> comm_ >> mbox_ >> dst_buff_);
}
std::string CommRecvTransition::to_string(bool verbose) const
{
CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, std::stringstream& stream)
: Transition(Type::COMM_SEND, issuer, times_considered)
{
- xbt_assert(stream >> mbox_ >> src_buff_ >> size_);
- XBT_DEBUG("SendTransition mbox:%u buff:%p size:%zu", mbox_, src_buff_, size_);
+ xbt_assert(stream >> comm_ >> mbox_ >> src_buff_ >> size_);
+ XBT_DEBUG("SendTransition comm:%p mbox:%u buff:%p size:%zu", comm_, mbox_, src_buff_, size_);
}
std::string CommSendTransition::to_string(bool verbose = false) const
{
};
class CommRecvTransition : public Transition {
+ void* comm_; /* Addr of the CommImpl */
unsigned mbox_;
void* dst_buff_;
};
class CommSendTransition : public Transition {
+ void* comm_; /* Addr of the CommImpl */
unsigned mbox_;
void* src_buff_;
size_t size_;