Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
partially stringify s4u::Actor
[simgrid.git] / src / s4u / s4u_Actor.cpp
index 8c45ca0..0e3ee32 100644 (file)
@@ -36,13 +36,13 @@ ActorPtr Actor::self()
   return self_context->process()->iface();
 }
 
-ActorPtr Actor::create(const char* name, s4u::Host* host, std::function<void()> code)
+ActorPtr Actor::create(std::string name, s4u::Host* host, std::function<void()> code)
 {
   simgrid::kernel::actor::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
   return actor->iface();
 }
 
-ActorPtr Actor::create(const char* name, s4u::Host* host, const char* function, std::vector<std::string> args)
+ActorPtr Actor::create(std::string name, s4u::Host* host, std::string function, std::vector<std::string> args)
 {
   simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
   simgrid::simix::ActorCode code            = factory(std::move(args));
@@ -225,12 +225,12 @@ std::unordered_map<std::string, std::string>* Actor::get_properties()
 }
 
 /** Retrieve the property value (or nullptr if not set) */
-const char* Actor::get_property(const char* key)
+const char* Actor::get_property(std::string key)
 {
   return simgrid::simix::simcall([this, key] { return pimpl_->get_property(key); });
 }
 
-void Actor::set_property(const char* key, const char* value)
+void Actor::set_property(std::string key, std::string value)
 {
   simgrid::simix::simcall([this, key, value] { pimpl_->set_property(key, value); });
 }
@@ -367,7 +367,7 @@ bool is_suspended()
   return simgrid::simix::simcall([process] { return process->suspended_; });
 }
 
-void kill()
+void exit()
 {
   smx_actor_t process = SIMIX_process_self();
   simgrid::simix::simcall([process] { SIMIX_process_kill(process, process); });
@@ -423,6 +423,10 @@ void onExit(int_f_pvoid_pvoid_t fun, void* data) /* deprecated */
 {
   on_exit([fun](int a, void* b) { fun((void*)(intptr_t)a, b); }, data);
 }
+void kill() /* deprecated */
+{
+  exit();
+}
 
 } // namespace this_actor
 } // namespace s4u