Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Assert that there is no memory leak (help scan-build).
[simgrid.git] / src / s4u / s4u_Actor.cpp
index b22b2b0..949daaa 100644 (file)
@@ -35,7 +35,7 @@ ActorPtr Actor::self()
   if (self_context == nullptr)
     return simgrid::s4u::ActorPtr();
 
-  return self_context->process()->iface();
+  return self_context->get_actor()->iface();
 }
 
 ActorPtr Actor::create(std::string name, s4u::Host* host, std::function<void()> code)
@@ -106,7 +106,7 @@ void Actor::migrate(Host* new_host)
       xbt_assert(exec.get() != nullptr, "We can only migrate blocked actors when they are blocked on executions.");
       exec->migrate(new_host);
     }
-    SIMIX_process_change_host(this->pimpl_, new_host);
+    this->pimpl_->change_host(new_host);
   });
 
   s4u::Actor::on_migration_end(this);
@@ -164,9 +164,9 @@ bool Actor::is_suspended()
   return simgrid::simix::simcall([this] { return pimpl_->suspended_; });
 }
 
-void Actor::set_kill_time(double time)
+void Actor::set_kill_time(double kill_time)
 {
-  simcall_process_set_kill_time(pimpl_, time);
+  simgrid::simix::simcall([this, kill_time] { pimpl_->set_kill_time(kill_time); });
 }
 
 /** @brief Get the kill time of an actor(or 0 if unset). */
@@ -338,11 +338,7 @@ void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, d
 
 ExecPtr exec_init(double flops_amount)
 {
-  ExecPtr res        = ExecPtr(new Exec());
-  res->host_         = get_host();
-  res->flops_amount_ = flops_amount;
-  res->set_remaining(flops_amount);
-  return res;
+  return ExecPtr(new Exec(get_host(), flops_amount));
 }
 
 ExecPtr exec_async(double flops)
@@ -460,7 +456,7 @@ void kill() /* deprecated */
  *
  * This function checks whether @a actor is a valid pointer and return its PID (or 0 in case of problem).
  */
-int sg_actor_get_PID(sg_actor_t actor)
+aid_t sg_actor_get_PID(sg_actor_t actor)
 {
   /* Do not raise an exception here: this function is called by the logs
    * and the exceptions, so it would be called back again and again */
@@ -475,7 +471,7 @@ int sg_actor_get_PID(sg_actor_t actor)
  * This function checks whether @a actor is a valid pointer and return its parent's PID.
  * Returns -1 if the actor has not been created by any other actor.
  */
-int sg_actor_get_PPID(sg_actor_t actor)
+aid_t sg_actor_get_PPID(sg_actor_t actor)
 {
   return actor->get_ppid();
 }