+
+ExecPtr Exec::set_hosts(const std::vector<Host*>& hosts)
+{
+ xbt_assert(state_ == State::INITED || state_ == State::STARTING,
+ "Cannot change the hosts of an exec once it's done (state: %s)", to_c_str(state_));
+
+ kernel::actor::simcall_object_access(pimpl_.get(), [this, hosts] {
+ boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)->set_hosts(hosts);
+ });
+ parallel_ = true;
+
+ // Setting the host may allow to start the activity, let's try
+ if (state_ == State::STARTING)
+ vetoable_start();
+
+ return this;
+}
+
+ExecPtr Exec::unset_host()
+{
+ if (not is_assigned())
+ throw std::invalid_argument(
+ xbt::string_printf("Exec %s: the activity is not assigned to any host(s)", get_cname()));
+ else {
+ reset();
+
+ if (state_ == State::STARTED)
+ cancel();
+ vetoable_start();
+
+ return this;
+ }
+}
+