]> AND Public Git Repository - simgrid.git/blobdiff - src/s4u/s4u_actor.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
further improve the doc of s4u::Mutex
[simgrid.git] / src / s4u / s4u_actor.cpp
index 79212bc73c0d572c1e5df52c231f14a22033552c..6eb67166842b18a5e2ffe3ff0181c98da0a7bd67 100644 (file)
@@ -12,6 +12,7 @@
 #include "simgrid/s4u/host.hpp"
 #include "simgrid/s4u/mailbox.hpp"
 
+#include "src/kernel/context/Context.hpp"
 #include "src/simix/smx_private.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor,"S4U actors");
@@ -26,7 +27,7 @@ ActorPtr Actor::self()
   if (self_context == nullptr)
     return simgrid::s4u::ActorPtr();
 
-  return simgrid::s4u::ActorPtr(&self_context->process()->actor());
+  return simgrid::s4u::ActorPtr(&self_context->process()->getIface());
 }
 
 
@@ -37,7 +38,7 @@ ActorPtr Actor::createActor(const char* name, s4u::Host *host, double killTime,
   smx_process_t process = simcall_process_create(
     name, std::move(code), nullptr, host->name().c_str(),
     killTime, nullptr, 0);
-  return Ptr(&process->actor());
+  return Ptr(&process->getIface());
 }
 
 ActorPtr Actor::createActor(const char* name, s4u::Host *host, double killTime,
@@ -48,7 +49,7 @@ ActorPtr Actor::createActor(const char* name, s4u::Host *host, double killTime,
   smx_process_t process = simcall_process_create(
     name, std::move(code), nullptr, host->name().c_str(),
     killTime, nullptr, 0);
-  return ActorPtr(&process->actor());
+  return ActorPtr(&process->getIface());
 }
 
 // ***** Actor methods *****
@@ -65,12 +66,12 @@ s4u::Host *Actor::getHost() {
   return pimpl_->host;
 }
 
-const char* Actor::getName() {
-  return pimpl_->name.c_str();
+simgrid::xbt::string Actor::getName() {
+  return pimpl_->name;
 }
 
 int Actor::getPid(){
-  return simcall_process_get_PID(pimpl_);
+  return pimpl_->pid;
 }
 
 void Actor::setKillTime(double time) {
@@ -106,7 +107,7 @@ ActorPtr Actor::forPid(int pid)
 {
   smx_process_t process = SIMIX_process_from_PID(pid);
   if (process != nullptr)
-    return ActorPtr(&process->actor());
+    return ActorPtr(&process->getIface());
   else
     return nullptr;
 }
@@ -154,7 +155,7 @@ void send(Mailbox &chan, void *payload, size_t simulatedSize) {
 }
 
 int getPid() {
-  return simcall_process_get_PID(SIMIX_process_self());
+  return SIMIX_process_self()->pid;
 }
 
 }