#include "simgrid/s4u/Actor.hpp"
#include "simgrid/s4u/Comm.hpp"
+#include "simgrid/s4u/Exec.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Mailbox.hpp"
simcall_process_join(this->pimpl_, -1);
}
+void Actor::join(double timeout)
+{
+ simcall_process_join(this->pimpl_, timeout);
+}
+
void Actor::setAutoRestart(bool autorestart) {
simgrid::simix::kernelImmediate([this, autorestart]() { pimpl_->auto_restart = autorestart; });
}
simcall_process_killall(resetPid);
}
+std::map<std::string, std::string>* Actor::getProperties()
+{
+ return simgrid::simix::kernelImmediate([this] { return this->pimpl_->getProperties(); });
+}
+
/** Retrieve the property value (or nullptr if not set) */
const char* Actor::getProperty(const char* key)
{
return simgrid::simix::kernelImmediate([this]() { return pimpl_->restart(); });
}
+ExecPtr Actor::exec_init(double flops_amount)
+{
+ ExecPtr res = ExecPtr(new Exec());
+ res->runner_ = SIMIX_process_self();
+ res->flops_amount_ = flops_amount;
+ res->setRemains(flops_amount);
+ return res;
+}
+
+ExecPtr Actor::exec_async(double flops)
+{
+ ExecPtr res = exec_init(flops);
+ res->start();
+ return res;
+}
+
// ***** this_actor *****
namespace this_actor {
simcall_process_sleep(duration);
}
+void yield()
+{
+ simgrid::simix::kernelImmediate([] { /* do nothing*/ });
+}
+
XBT_PUBLIC(void) sleep_until(double timeout)
{
double now = SIMIX_get_clock();
simcall_execution_wait(s);
}
-void execute(double flops,double priority)
+void execute(double flops, double priority)
{
smx_activity_t s = simcall_execution_start(nullptr,flops,1 / priority/*priority*/,0./*bound*/);
simcall_execution_wait(s);
}
+void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double timeout)
+{
+ smx_activity_t s =
+ simcall_execution_parallel_start(nullptr, host_nb, host_list, flops_amount, bytes_amount, -1, timeout);
+ simcall_execution_wait(s);
+}
+
+void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount)
+{
+ smx_activity_t s = simcall_execution_parallel_start(nullptr, host_nb, host_list, flops_amount, bytes_amount, -1, -1);
+ simcall_execution_wait(s);
+}
+
void* recv(MailboxPtr chan) // deprecated
{
return chan->get();