std::transform(begin(*comms), end(*comms), begin(rcomms),
[](const CommPtr& comm) { return static_cast<kernel::activity::CommImpl*>(comm->pimpl_.get()); });
int changed_pos = simcall_comm_waitany(rcomms.data(), rcomms.size(), timeout);
- if (changed_pos != -1)
+ if (changed_pos != -1) {
+ on_completion(*(comms->at(changed_pos)));
comms->at(changed_pos)->release_dependencies();
+ }
return changed_pos;
}
return res;
}
+void Comm::sendto(Host* from, Host* to, double simulated_size_in_bytes)
+{
+ sendto_async(from, to, simulated_size_in_bytes)->wait();
+}
+
Comm* Comm::start()
{
xbt_assert(get_state() == State::INITED || get_state() == State::STARTING,
xbt_assert(src_buff_ == nullptr && dst_buff_ == nullptr,
"Direct host-to-host communications cannot carry any data.");
pimpl_ = kernel::actor::simcall([this] {
- auto res = new kernel::activity::CommImpl(this->from_, this->to_, this->get_remaining());
+ kernel::activity::CommImplPtr res(new kernel::activity::CommImpl(this->from_, this->to_, this->get_remaining()));
res->start();
return res;
});