void execute(double flops, double priority)
{
- exec_init(flops)->set_priority(priority)->start()->wait();
+ exec_init(flops)->set_priority(priority)->vetoable_start()->wait();
}
void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
ExecPtr exec_init(double flops_amount)
{
- ExecPtr exec(new Exec());
- exec->set_flops_amount(flops_amount)->set_host(get_host());
- return exec;
+ return Exec::init()->set_flops_amount(flops_amount)->set_host(get_host());
}
ExecPtr exec_init(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
xbt_assert(std::all_of(bytes_amounts.begin(), bytes_amounts.end(), [](double elm) { return std::isfinite(elm); }),
"flops_amounts comprises infinite values!");
- ExecPtr exec(new Exec());
- exec->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(hosts);
- return exec;
+ return Exec::init()->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(hosts);
}
ExecPtr exec_async(double flops)
{
ExecPtr res = exec_init(flops);
- res->start();
+ res->vetoable_start();
return res;
}
if (bytes_amount != nullptr)
bytes = std::vector<double>(bytes_amount, bytes_amount + host_nb * host_nb);
- simgrid::s4u::ExecPtr exec(new simgrid::s4u::Exec());
- exec->set_flops_amounts(flops)->set_bytes_amounts(bytes)->set_hosts(hosts);
+ simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_init(hosts, flops, bytes);
exec->add_ref();
return exec.get();
}