Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
s/process/actor/ A lot remains TBD about it
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 20 Jan 2019 11:19:38 +0000 (12:19 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 20 Jan 2019 21:56:17 +0000 (22:56 +0100)
13 files changed:
src/bindings/java/JavaContext.cpp
src/kernel/context/Context.hpp
src/kernel/context/ContextBoost.cpp
src/kernel/context/ContextBoost.hpp
src/kernel/context/ContextRaw.cpp
src/kernel/context/ContextRaw.hpp
src/kernel/context/ContextSwapped.hpp
src/kernel/context/ContextThread.cpp
src/kernel/context/ContextThread.hpp
src/kernel/context/ContextUnix.cpp
src/kernel/context/ContextUnix.hpp
src/s4u/s4u_Actor.cpp
src/simix/ActorImpl.cpp

index 7cc00a2..4a742fd 100644 (file)
@@ -78,7 +78,7 @@ void JavaContext::stop()
     // (as the ones created for the VM migration). The Java exception will not be catched anywhere.
     // Bad things happen currently if these actors get killed, unfortunately.
     jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError",
     // (as the ones created for the VM migration). The Java exception will not be catched anywhere.
     // Bad things happen currently if these actors get killed, unfortunately.
     jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError",
-                       std::string("Process ") + this->process()->get_cname() + " killed from file JavaContext.cpp");
+                       std::string("Process ") + this->get_actor()->get_cname() + " killed from file JavaContext.cpp");
 
     // (remember that throwing a java exception from C does not break the C execution path.
     //  Instead, it marks the exception to be raised when returning to the Java world and
 
     // (remember that throwing a java exception from C does not break the C execution path.
     //  Instead, it marks the exception to be raised when returning to the Java world and
index 9a6ace7..10ddbe6 100644 (file)
@@ -57,14 +57,14 @@ private:
 public:
   bool iwannadie = false;
 
 public:
   bool iwannadie = false;
 
-  Context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process);
+  Context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor);
   Context(const Context&) = delete;
   Context& operator=(const Context&) = delete;
   virtual ~Context();
 
   void operator()() { code_(); }
   bool has_code() const { return static_cast<bool>(code_); }
   Context(const Context&) = delete;
   Context& operator=(const Context&) = delete;
   virtual ~Context();
 
   void operator()() { code_(); }
   bool has_code() const { return static_cast<bool>(code_); }
-  smx_actor_t process() { return this->actor_; }
+  smx_actor_t get_actor() { return this->actor_; }
   void set_cleanup(void_pfn_smxprocess_t cleanup) { cleanup_func_ = cleanup; }
 
   // Scheduling methods
   void set_cleanup(void_pfn_smxprocess_t cleanup) { cleanup_func_ = cleanup; }
 
   // Scheduling methods
index ac88b68..e229a5c 100644 (file)
@@ -23,9 +23,9 @@ smx_context_t BoostContextFactory::create_context(std::function<void()> code, vo
 
 // BoostContext
 
 
 // BoostContext
 
-BoostContext::BoostContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
+BoostContext::BoostContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor,
                            SwappedContextFactory* factory)
                            SwappedContextFactory* factory)
-    : SwappedContext(std::move(code), cleanup_func, process, factory)
+    : SwappedContext(std::move(code), cleanup_func, actor, factory)
 {
 
   /* if the user provided a function for the process then use it, otherwise it is the context for maestro */
 {
 
   /* if the user provided a function for the process then use it, otherwise it is the context for maestro */
index 99dad30..d78cc23 100644 (file)
@@ -32,7 +32,7 @@ namespace context {
 /** @brief Userspace context switching implementation based on Boost.Context */
 class BoostContext : public SwappedContext {
 public:
 /** @brief Userspace context switching implementation based on Boost.Context */
 class BoostContext : public SwappedContext {
 public:
-  BoostContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
+  BoostContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor,
                SwappedContextFactory* factory);
   ~BoostContext() override;
 
                SwappedContextFactory* factory);
   ~BoostContext() override;
 
index 3b29062..ffffc65 100644 (file)
@@ -194,9 +194,9 @@ Context* RawContextFactory::create_context(std::function<void()> code, void_pfn_
 
 // RawContext
 
 
 // RawContext
 
-RawContext::RawContext(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t process,
+RawContext::RawContext(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t actor,
                        SwappedContextFactory* factory)
                        SwappedContextFactory* factory)
-    : SwappedContext(std::move(code), cleanup, process, factory)
+    : SwappedContext(std::move(code), cleanup, actor, factory)
 {
    if (has_code()) {
 #if PTH_STACKGROWTH == -1
 {
    if (has_code()) {
 #if PTH_STACKGROWTH == -1
index 89e72bc..a27e81b 100644 (file)
@@ -26,7 +26,7 @@ namespace context {
   */
 class RawContext : public SwappedContext {
 public:
   */
 class RawContext : public SwappedContext {
 public:
-  RawContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
+  RawContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor,
              SwappedContextFactory* factory);
 
   void swap_into(SwappedContext* to) override;
              SwappedContextFactory* factory);
 
   void swap_into(SwappedContext* to) override;
index 77bbbf1..60d9987 100644 (file)
@@ -35,7 +35,7 @@ private:
 
 class SwappedContext : public Context {
 public:
 
 class SwappedContext : public Context {
 public:
-  SwappedContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
+  SwappedContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t get_actor,
                  SwappedContextFactory* factory);
   virtual ~SwappedContext();
 
                  SwappedContextFactory* factory);
   virtual ~SwappedContext();
 
index a3c6088..64188a6 100644 (file)
@@ -36,12 +36,12 @@ ThreadContextFactory::~ThreadContextFactory()
 }
 
 ThreadContext* ThreadContextFactory::create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup,
 }
 
 ThreadContext* ThreadContextFactory::create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup,
-                                                    smx_actor_t process, bool maestro)
+                                                    smx_actor_t actor, bool maestro)
 {
   if (parallel_)
 {
   if (parallel_)
-    return this->new_context<ParallelThreadContext>(std::move(code), cleanup, process, maestro);
+    return this->new_context<ParallelThreadContext>(std::move(code), cleanup, actor, maestro);
   else
   else
-    return this->new_context<SerialThreadContext>(std::move(code), cleanup, process, maestro);
+    return this->new_context<SerialThreadContext>(std::move(code), cleanup, actor, maestro);
 }
 
 void ThreadContextFactory::run_all()
 }
 
 void ThreadContextFactory::run_all()
@@ -60,11 +60,11 @@ void ThreadContextFactory::run_all()
 ThreadContext::ThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t actor, bool maestro)
     : AttachContext(std::move(code), cleanup, actor), is_maestro_(maestro)
 {
 ThreadContext::ThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t actor, bool maestro)
     : AttachContext(std::move(code), cleanup, actor), is_maestro_(maestro)
 {
-  /* If the user provided a function for the process then use it */
+  /* If the user provided a function for the actor then use it */
   if (has_code()) {
   if (has_code()) {
-    /* create and start the process */
+    /* create and start the actor */
     this->thread_ = new std::thread(ThreadContext::wrapper, this);
     this->thread_ = new std::thread(ThreadContext::wrapper, this);
-    /* wait the starting of the newly created process */
+    /* wait the starting of the newly created actor */
     this->end_.acquire();
   }
 
     this->end_.acquire();
   }
 
@@ -178,9 +178,9 @@ void ThreadContext::attach_stop()
 
 void SerialThreadContext::run_all()
 {
 
 void SerialThreadContext::run_all()
 {
-  for (smx_actor_t const& process : simix_global->process_to_run) {
-    XBT_DEBUG("Handling %p", process);
-    ThreadContext* context = static_cast<ThreadContext*>(process->context_);
+  for (smx_actor_t const& actor : simix_global->process_to_run) {
+    XBT_DEBUG("Handling %p", actor);
+    ThreadContext* context = static_cast<ThreadContext*>(actor->context_);
     context->release();
     context->wait();
   }
     context->release();
     context->wait();
   }
@@ -203,10 +203,10 @@ void ParallelThreadContext::finalize()
 
 void ParallelThreadContext::run_all()
 {
 
 void ParallelThreadContext::run_all()
 {
-  for (smx_actor_t const& process : simix_global->process_to_run)
-    static_cast<ThreadContext*>(process->context_)->release();
-  for (smx_actor_t const& process : simix_global->process_to_run)
-    static_cast<ThreadContext*>(process->context_)->wait();
+  for (smx_actor_t const& actor : simix_global->process_to_run)
+    static_cast<ThreadContext*>(actor->context_)->release();
+  for (smx_actor_t const& actor : simix_global->process_to_run)
+    static_cast<ThreadContext*>(actor->context_)->wait();
 }
 
 void ParallelThreadContext::start_hook()
 }
 
 void ParallelThreadContext::start_hook()
index 4c76ae2..623aec4 100644 (file)
@@ -20,7 +20,7 @@ namespace context {
 
 class XBT_PUBLIC ThreadContext : public AttachContext {
 public:
 
 class XBT_PUBLIC ThreadContext : public AttachContext {
 public:
-  ThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process, bool maestro);
+  ThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor, bool maestro);
   ~ThreadContext() override;
   void stop() override;
   void suspend() override;
   ~ThreadContext() override;
   void stop() override;
   void suspend() override;
@@ -34,7 +34,7 @@ public:
 private:
   /** A portable thread */
   std::thread* thread_ = nullptr;
 private:
   /** A portable thread */
   std::thread* thread_ = nullptr;
-  /** Semaphore used to schedule/yield the process (not needed when the maestro is in main, but harmless then) */
+  /** Semaphore used to schedule/yield the actor (not needed when the maestro is in main, but harmless then) */
   xbt::OsSemaphore begin_{0};
   /** Semaphore used to schedule/unschedule (not needed when the maestro is in main, but harmless then) */
   xbt::OsSemaphore end_{0};
   xbt::OsSemaphore begin_{0};
   /** Semaphore used to schedule/unschedule (not needed when the maestro is in main, but harmless then) */
   xbt::OsSemaphore end_{0};
@@ -50,8 +50,8 @@ private:
 
 class XBT_PUBLIC SerialThreadContext : public ThreadContext {
 public:
 
 class XBT_PUBLIC SerialThreadContext : public ThreadContext {
 public:
-  SerialThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process, bool maestro)
-      : ThreadContext(std::move(code), cleanup_func, process, maestro)
+  SerialThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor, bool maestro)
+      : ThreadContext(std::move(code), cleanup_func, actor, maestro)
   {
   }
 
   {
   }
 
@@ -60,9 +60,8 @@ public:
 
 class ParallelThreadContext : public ThreadContext {
 public:
 
 class ParallelThreadContext : public ThreadContext {
 public:
-  ParallelThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
-                        bool maestro)
-      : ThreadContext(std::move(code), cleanup_func, process, maestro)
+  ParallelThreadContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor, bool maestro)
+      : ThreadContext(std::move(code), cleanup_func, actor, maestro)
   {
   }
 
   {
   }
 
@@ -82,27 +81,27 @@ public:
   ThreadContextFactory();
   ~ThreadContextFactory() override;
   ThreadContext* create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func,
   ThreadContextFactory();
   ~ThreadContextFactory() override;
   ThreadContext* create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func,
-                                smx_actor_t process) override
+                                smx_actor_t actor) override
   {
     bool maestro = not code;
   {
     bool maestro = not code;
-    return create_context(std::move(code), cleanup_func, process, maestro);
+    return create_context(std::move(code), cleanup_func, actor, maestro);
   }
   void run_all() override;
 
   // Optional methods:
   }
   void run_all() override;
 
   // Optional methods:
-  ThreadContext* attach(void_pfn_smxprocess_t cleanup_func, smx_actor_t process) override
+  ThreadContext* attach(void_pfn_smxprocess_t cleanup_func, smx_actor_t actor) override
   {
   {
-    return create_context(std::function<void()>(), cleanup_func, process, false);
+    return create_context(std::function<void()>(), cleanup_func, actor, false);
   }
   }
-  ThreadContext* create_maestro(std::function<void()> code, smx_actor_t process) override
+  ThreadContext* create_maestro(std::function<void()> code, smx_actor_t actor) override
   {
   {
-    return create_context(std::move(code), nullptr, process, true);
+    return create_context(std::move(code), nullptr, actor, true);
   }
 
 private:
   bool parallel_;
 
   }
 
 private:
   bool parallel_;
 
-  ThreadContext* create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
+  ThreadContext* create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor,
                                 bool maestro);
 };
 }}} // namespace
                                 bool maestro);
 };
 }}} // namespace
index 1b0398e..de67f76 100644 (file)
@@ -30,17 +30,17 @@ namespace kernel {
 namespace context {
 
 // UContextFactory
 namespace context {
 
 // UContextFactory
-Context* UContextFactory::create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t process)
+Context* UContextFactory::create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t actor)
 {
 {
-  return new_context<UContext>(std::move(code), cleanup, process, this);
+  return new_context<UContext>(std::move(code), cleanup, actor, this);
 }
 
 
 // UContext
 
 }
 
 
 // UContext
 
-UContext::UContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
+UContext::UContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor,
                    SwappedContextFactory* factory)
                    SwappedContextFactory* factory)
-    : SwappedContext(std::move(code), cleanup_func, process, factory)
+    : SwappedContext(std::move(code), cleanup_func, actor, factory)
 {
   /* if the user provided a function for the process then use it, otherwise it is the context for maestro */
   if (has_code()) {
 {
   /* if the user provided a function for the process then use it, otherwise it is the context for maestro */
   if (has_code()) {
@@ -58,7 +58,7 @@ UContext::UContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_fun
 
 #if SIMGRID_HAVE_MC
   if (MC_is_active() && has_code()) {
 
 #if SIMGRID_HAVE_MC
   if (MC_is_active() && has_code()) {
-    MC_register_stack_area(get_stack(), process, &(this->uc_), smx_context_usable_stack_size);
+    MC_register_stack_area(get_stack(), actor, &(this->uc_), smx_context_usable_stack_size);
   }
 #endif
 }
   }
 #endif
 }
index 211da7e..d3b3659 100644 (file)
@@ -25,7 +25,7 @@ namespace context {
 
 class UContext : public SwappedContext {
 public:
 
 class UContext : public SwappedContext {
 public:
-  UContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
+  UContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor,
            SwappedContextFactory* factory);
 
   void swap_into(SwappedContext* to) override;
            SwappedContextFactory* factory);
 
   void swap_into(SwappedContext* to) override;
index 3869be9..f5c00f3 100644 (file)
@@ -35,7 +35,7 @@ ActorPtr Actor::self()
   if (self_context == nullptr)
     return simgrid::s4u::ActorPtr();
 
   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)
 }
 
 ActorPtr Actor::create(std::string name, s4u::Host* host, std::function<void()> code)
index 9f72900..353b70d 100644 (file)
@@ -36,7 +36,7 @@ smx_actor_t SIMIX_process_self()
 {
   smx_context_t self_context = simgrid::kernel::context::Context::self();
 
 {
   smx_context_t self_context = simgrid::kernel::context::Context::self();
 
-  return (self_context != nullptr) ? self_context->process() : nullptr;
+  return (self_context != nullptr) ? self_context->get_actor() : nullptr;
 }
 
 /**
 }
 
 /**
@@ -430,7 +430,7 @@ void SIMIX_process_detach()
   if (context == nullptr)
     xbt_die("Not a suitable context");
 
   if (context == nullptr)
     xbt_die("Not a suitable context");
 
-  SIMIX_process_cleanup(context->process());
+  SIMIX_process_cleanup(context->get_actor());
   context->attach_stop();
 }
 
   context->attach_stop();
 }