XBT_PUBLIC void* sg_actor_data(const_sg_actor_t actor);
XBT_PUBLIC void sg_actor_data_set(sg_actor_t actor, void* userdata);
+XBT_PUBLIC sg_exec_t sg_actor_exec_init(double computation_amount);
+XBT_PUBLIC sg_exec_t sg_actor_exec_async(double computation_amount);
SG_END_DECL
#endif /* INCLUDE_SIMGRID_ACTOR_H_ */
--- /dev/null
+/* Copyright (c) 2018-2020. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef INCLUDE_SIMGRID_EXEC_H_
+#define INCLUDE_SIMGRID_EXEC_H_
+
+#include <simgrid/forward.h>
+#include <xbt/dynar.h>
+
+/* C interface */
+SG_BEGIN_DECL
+
+XBT_PUBLIC void sg_exec_set_bound(sg_exec_t exec, double bound);
+XBT_PUBLIC double sg_exec_get_remaining(sg_exec_t exec);
+
+XBT_PUBLIC void sg_exec_start(sg_exec_t exec);
+XBT_PUBLIC void sg_exec_wait(sg_exec_t exec);
+XBT_PUBLIC void sg_exec_wait_for(sg_exec_t exec, double timeout);
+
+SG_END_DECL
+
+#endif /* INCLUDE_SIMGRID_COMM_H_ */
{
simgrid::s4u::this_actor::on_exit([fun, data](bool failed) { fun(failed ? 1 /*FAILURE*/ : 0 /*SUCCESS*/, data); });
}
+
+sg_exec_t sg_actor_exec_init(double computation_amount)
+{
+ simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_init(computation_amount);
+ exec->add_ref();
+ return exec.get();
+}
+
+sg_exec_t sg_actor_exec_async(double computation_amount)
+{
+ simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_async(computation_amount);
+ exec->add_ref();
+ return exec.get();
+}
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include "simgrid/exec.h"
#include "simgrid/s4u/Actor.hpp"
#include "simgrid/s4u/Exec.hpp"
#include "src/kernel/activity/ExecImpl.hpp"
} // namespace s4u
} // namespace simgrid
+/* **************************** Public C interface *************************** */
+void sg_exec_set_bound(sg_exec_t exec, double bound)
+{
+ exec->set_bound(bound);
+}
+
+double sg_exec_get_remaining(sg_exec_t exec)
+{
+ return exec->get_remaining();
+}
+
+void sg_exec_start(sg_exec_t exec)
+{
+ exec->start();
+}
+
+void sg_exec_wait(sg_exec_t exec)
+{
+ exec->wait_for(-1);
+ exec->unref();
+}
+
+void sg_exec_wait_for(sg_exec_t exec, double timeout)
+{
+ exec->wait_for(timeout);
+ exec->unref();
+}
include/simgrid/barrier.h
include/simgrid/comm.h
include/simgrid/engine.h
+ include/simgrid/exec.h
include/simgrid/Exception.hpp
include/simgrid/chrono.hpp
include/simgrid/plugins/dvfs.h