void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
void* data, double timeout)
{
- smx_activity_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate, src_buff, src_buff_size,
- match_fun, nullptr, copy_data_fun, data, 0);
+ simgrid::kernel::activity::ActivityImplPtr comm = simcall_HANDLER_comm_isend(
+ simcall, src, mbox, task_size, rate, src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, false);
SIMCALL_SET_MC_VALUE(*simcall, 0);
simcall_HANDLER_comm_wait(simcall, static_cast<simgrid::kernel::activity::CommImpl*>(comm.get()), timeout);
}
-XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend(
+XBT_PRIVATE simgrid::kernel::activity::ActivityImplPtr simcall_HANDLER_comm_isend(
smx_simcall_t /*simcall*/, smx_actor_t src_proc, smx_mailbox_t mbox, double task_size, double rate,
unsigned char* src_buff, size_t src_buff_size,
bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
XBT_DEBUG("send from mailbox %p", mbox);
/* Prepare a synchro describing us, so that it gets passed to the user-provided filter of other side */
- simgrid::kernel::activity::CommImplPtr this_comm =
- simgrid::kernel::activity::CommImplPtr(new simgrid::kernel::activity::CommImpl());
+ simgrid::kernel::activity::CommImplPtr this_comm(new simgrid::kernel::activity::CommImpl());
this_comm->set_type(simgrid::kernel::activity::CommImpl::Type::SEND);
/* Look for communication synchro matching our needs. We also provide a description of
other_comm->clean_fun = clean_fun;
} else {
other_comm->clean_fun = nullptr;
- src_proc->comms.push_back(other_comm);
+ src_proc->activities_.emplace_back(other_comm);
}
/* Setup the communication synchro */
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
void* data, double timeout, double rate)
{
- smx_activity_t comm = simcall_HANDLER_comm_irecv(simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun,
- copy_data_fun, data, rate);
+ simgrid::kernel::activity::ActivityImplPtr comm = simcall_HANDLER_comm_irecv(
+ simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
SIMCALL_SET_MC_VALUE(*simcall, 0);
simcall_HANDLER_comm_wait(simcall, static_cast<simgrid::kernel::activity::CommImpl*>(comm.get()), timeout);
}
-XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_irecv(
- smx_simcall_t /*simcall*/, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size,
- bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
- void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data, double rate)
+XBT_PRIVATE simgrid::kernel::activity::ActivityImplPtr
+simcall_HANDLER_comm_irecv(smx_simcall_t /*simcall*/, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff,
+ size_t* dst_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
+ double rate)
{
- simgrid::kernel::activity::CommImplPtr this_synchro =
- simgrid::kernel::activity::CommImplPtr(new simgrid::kernel::activity::CommImpl());
+ simgrid::kernel::activity::CommImplPtr this_synchro(new simgrid::kernel::activity::CommImpl());
this_synchro->set_type(simgrid::kernel::activity::CommImpl::Type::RECEIVE);
XBT_DEBUG("recv from mbox %p. this_synchro=%p", mbox, this_synchro.get());
other_comm->state_ = simgrid::kernel::activity::State::READY;
other_comm->set_type(simgrid::kernel::activity::CommImpl::Type::READY);
}
- receiver->comms.push_back(other_comm);
+ receiver->activities_.emplace_back(other_comm);
}
/* Setup communication synchro */
}
if (timeout < 0.0) {
- simcall->timeout_cb_ = NULL;
+ simcall->timeout_cb_ = nullptr;
} else {
simcall->timeout_cb_ = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [simcall]() {
+ simcall->timeout_cb_ = nullptr;
SIMIX_waitany_remove_simcall_from_actions(simcall);
simcall_comm_waitany__set__result(simcall, -1);
simcall->issuer_->simcall_answer();
/* Check out for errors */
if (not simcall->issuer_->get_host()->is_on()) {
- simcall->issuer_->context_->iwannadie = true;
+ simcall->issuer_->context_->set_wannadie();
} else {
switch (state_) {
case State::DONE:
case State::SRC_HOST_FAILURE:
if (simcall->issuer_ == src_actor_)
- simcall->issuer_->context_->iwannadie = true;
+ simcall->issuer_->context_->set_wannadie();
else
simcall->issuer_->exception_ =
std::make_exception_ptr(simgrid::NetworkFailureException(XBT_THROW_POINT, "Remote peer failed"));
case State::DST_HOST_FAILURE:
if (simcall->issuer_ == dst_actor_)
- simcall->issuer_->context_->iwannadie = true;
+ simcall->issuer_->context_->set_wannadie();
else
simcall->issuer_->exception_ =
std::make_exception_ptr(simgrid::NetworkFailureException(XBT_THROW_POINT, "Remote peer failed"));
}
}
- simcall->issuer_->waiting_synchro = nullptr;
- simcall->issuer_->comms.remove(this);
+ simcall->issuer_->waiting_synchro_ = nullptr;
+ simcall->issuer_->activities_.remove(this);
if (detached_) {
if (simcall->issuer_ == src_actor_) {
if (dst_actor_)
- dst_actor_->comms.remove(this);
+ dst_actor_->activities_.remove(this);
} else if (simcall->issuer_ == dst_actor_) {
if (src_actor_)
- src_actor_->comms.remove(this);
+ src_actor_->activities_.remove(this);
} else {
- dst_actor_->comms.remove(this);
- src_actor_->comms.remove(this);
+ dst_actor_->activities_.remove(this);
+ src_actor_->activities_.remove(this);
}
}
}