copied_ = true;
}
-ActivityImplPtr CommImpl::isend(actor::CommIsendSimcall* observer)
+ActivityImplPtr CommImpl::isend(const actor::CommIsendSimcall* observer)
{
auto* mbox = observer->get_mailbox();
XBT_DEBUG("send from mailbox %p", mbox);
*
* If it is not found then push our communication into the rendez-vous point */
CommImplPtr other_comm =
- mbox->find_matching_comm(CommImpl::Type::RECEIVE, observer->match_fun_, observer->get_payload(), this_comm,
+ mbox->find_matching_comm(CommImpl::Type::RECEIVE, observer->get_match_fun(), observer->get_payload(), this_comm,
/*done*/ false, /*remove_matching*/ true);
if (not other_comm) {
if (observer->is_detached()) {
other_comm->detach();
- other_comm->clean_fun = observer->clean_fun_;
+ other_comm->clean_fun = observer->get_clean_fun();
} else {
other_comm->clean_fun = nullptr;
observer->get_issuer()->activities_.emplace_back(other_comm);
.set_size(observer->get_payload_size())
.set_rate(observer->get_rate());
- other_comm->match_fun = observer->match_fun_;
- other_comm->copy_data_fun = observer->copy_data_fun_;
+ other_comm->match_fun = observer->get_match_fun();
+ other_comm->copy_data_fun = observer->get_copy_data_fun();
if (MC_is_active() || MC_record_replay_is_active())
other_comm->set_state(simgrid::kernel::activity::State::RUNNING);
return (observer->is_detached() ? nullptr : other_comm);
}
-ActivityImplPtr CommImpl::irecv(actor::CommIrecvSimcall* observer)
+ActivityImplPtr CommImpl::irecv(const actor::CommIrecvSimcall* observer)
{
CommImplPtr this_synchro(new CommImpl(CommImpl::Type::RECEIVE));
auto* mbox = observer->get_mailbox();
if (mbox->is_permanent() && mbox->has_some_done_comm()) {
XBT_DEBUG("We have a comm that has probably already been received, trying to match it, to skip the communication");
// find a match in the list of already received comms
- other_comm = mbox->find_matching_comm(CommImpl::Type::SEND, observer->match_fun_, observer->get_payload(),
+ other_comm = mbox->find_matching_comm(CommImpl::Type::SEND, observer->get_match_fun(), observer->get_payload(),
this_synchro, /*done*/ true, /*remove_matching*/ true);
// if not found, assume the receiver came first, register it to the mailbox in the classical way
if (not other_comm) {
* ourself so that the other side also gets a chance of choosing if it wants to match with us.
*
* If it is not found then push our communication into the rendez-vous point */
- other_comm = mbox->find_matching_comm(CommImpl::Type::SEND, observer->match_fun_, observer->get_payload(),
+ other_comm = mbox->find_matching_comm(CommImpl::Type::SEND, observer->get_match_fun(), observer->get_payload(),
this_synchro, /*done*/ false, /*remove_matching*/ true);
if (other_comm == nullptr) {
if (observer->get_rate() > -1.0 && (other_comm->get_rate() < 0.0 || observer->get_rate() < other_comm->get_rate()))
other_comm->set_rate(observer->get_rate());
- other_comm->match_fun = observer->match_fun_;
- other_comm->copy_data_fun = observer->copy_data_fun_;
+ other_comm->match_fun = observer->get_match_fun();
+ other_comm->copy_data_fun = observer->get_copy_data_fun();
if (MC_is_active() || MC_record_replay_is_active()) {
other_comm->set_state(State::RUNNING);
void* payload_;
bool detached_;
-public:
bool (*match_fun_)(void*, void*, activity::CommImpl*);
void (*clean_fun_)(void*); // used to free the synchro in case of problem after a detached send
void (*copy_data_fun_)(activity::CommImpl*, void*, size_t); // used to copy data if not default one
+public:
CommIsendSimcall(ActorImpl* actor, activity::MailboxImpl* mbox, double payload_size, double rate,
unsigned char* src_buff, size_t src_buff_size, 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_; }
+
+ auto get_match_fun() const { return match_fun_; }
+ auto get_clean_fun() const { return clean_fun_; }
+ auto get_copy_data_fun() const { return copy_data_fun_; }
};
class CommIrecvSimcall : public SimcallObserver {
void* payload_;
double rate_;
-public:
bool (*match_fun_)(void*, void*, activity::CommImpl*);
void (*copy_data_fun_)(activity::CommImpl*, void*, size_t); // used to copy data if not default one
+public:
CommIrecvSimcall(ActorImpl* actor, activity::MailboxImpl* mbox, unsigned char* dst_buff, size_t* dst_buff_size,
bool (*match_fun)(void*, void*, activity::CommImpl*),
void (*copy_data_fun)(activity::CommImpl*, void*, size_t), void* payload, double rate)
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_; }
+
+ auto get_match_fun() const { return match_fun_; };
+ auto get_copy_data_fun() const { return copy_data_fun_; }
};
} // namespace actor