From: Martin Quinson Date: Mon, 1 Aug 2016 09:28:40 +0000 (+0200) Subject: Rename smx_process to ActorImpl X-Git-Tag: v3_14~663 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a2a013c0e4ca407feeb7b3d0e85abba7acae2532 Rename smx_process to ActorImpl --- diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index 7f3f4a6267..5fbd5f8e20 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -132,7 +132,7 @@ namespace s4u { /** @brief Simulation Agent (see \ref s4u_actor)*/ XBT_PUBLIC_CLASS Actor { friend Mailbox; - friend simgrid::simix::Process; + friend simgrid::simix::ActorImpl; smx_process_t pimpl_ = nullptr; /** Wrap a (possibly non-copyable) single-use task into a `std::function` */ diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 4d766f254f..6b03ad7917 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -28,7 +28,7 @@ namespace simix { data, executing in a location. \see m_process_management @{ */ - class Process; + class ActorImpl; class Context; class ContextFactory; class Mutex; @@ -37,7 +37,7 @@ namespace simix { } typedef simgrid::simix::Context *smx_context_t; -typedef simgrid::simix::Process *smx_process_t; +typedef simgrid::simix::ActorImpl *smx_process_t; typedef simgrid::simix::Mutex *smx_mutex_t; typedef simgrid::simix::Mailbox *smx_mailbox_t; diff --git a/src/kernel/activity/SynchroSleep.cpp b/src/kernel/activity/SynchroSleep.cpp index e8f10df5a4..5335d50e4e 100644 --- a/src/kernel/activity/SynchroSleep.cpp +++ b/src/kernel/activity/SynchroSleep.cpp @@ -8,9 +8,10 @@ #include #include "src/kernel/activity/SynchroSleep.hpp" + #include "src/surf/surf_interface.hpp" +#include "src/simix/ActorImpl.hpp" #include "src/simix/popping_private.h" -#include "src/simix/smx_process_private.h" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process); diff --git a/src/mc/Process.hpp b/src/mc/Process.hpp index 23d262081e..97787020e0 100644 --- a/src/mc/Process.hpp +++ b/src/mc/Process.hpp @@ -45,8 +45,8 @@ namespace mc { class SimixProcessInformation { public: /** MCed address of the process */ - RemotePtr address = nullptr; - Remote copy; + RemotePtr address = nullptr; + Remote copy; /** Hostname (owned by `mc_modelchecker->hostnames`) */ const char* hostname = nullptr; @@ -224,7 +224,7 @@ public: /** Get a local description of a remote SIMIX process */ simgrid::mc::SimixProcessInformation* resolveProcessInfo( - simgrid::mc::RemotePtr process) + simgrid::mc::RemotePtr process) { xbt_assert(mc_model_checker != nullptr); if (!process) @@ -240,7 +240,7 @@ public: } /** Get a local copy of the SIMIX process structure */ - simgrid::simix::Process* resolveProcess(simgrid::mc::RemotePtr process) + simgrid::simix::ActorImpl* resolveProcess(simgrid::mc::RemotePtr process) { simgrid::mc::SimixProcessInformation* process_info = this->resolveProcessInfo(process); diff --git a/src/mc/mc_global.cpp b/src/mc/mc_global.cpp index d6d0b5102d..aaae1d47a1 100644 --- a/src/mc/mc_global.cpp +++ b/src/mc/mc_global.cpp @@ -27,7 +27,7 @@ #include #endif -#include "src/simix/smx_process_private.h" +#include "src/simix/ActorImpl.hpp" #if HAVE_MC #include diff --git a/src/mc/mc_record.cpp b/src/mc/mc_record.cpp index f5d3f2b333..4a8fb95748 100644 --- a/src/mc/mc_record.cpp +++ b/src/mc/mc_record.cpp @@ -17,11 +17,11 @@ #include "simgrid/simix.h" +#include "src/simix/ActorImpl.hpp" #include "src/simix/smx_private.h" -#include "src/simix/smx_process_private.h" - #include "src/mc/mc_replay.h" #include "src/mc/mc_record.h" + #include "src/mc/mc_base.h" #include "src/mc/Transition.hpp" diff --git a/src/msg/instr_msg_process.cpp b/src/msg/instr_msg_process.cpp index 6767f99335..bcdb775ff8 100644 --- a/src/msg/instr_msg_process.cpp +++ b/src/msg/instr_msg_process.cpp @@ -4,8 +4,8 @@ /* 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 "src/simix/ActorImpl.hpp" #include "msg_private.h" -#include "src/simix/smx_process_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg_process, instr, "MSG process"); diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index 0a2d2a9448..cf775374c6 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -10,7 +10,7 @@ #include "xbt/sysdep.h" #include "xbt/log.h" #include "xbt/functional.hpp" -#include "src/simix/smx_process_private.h" +#include "src/simix/ActorImpl.hpp" #include "src/simix/smx_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)"); diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 68f66fd416..6db4d97e9e 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -26,7 +26,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 +37,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 +48,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 ***** @@ -106,7 +106,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; } diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index f17f894f40..e4d3d6c06a 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -14,7 +14,7 @@ #include "src/surf/HostImpl.hpp" #include "xbt/log.h" #include "src/msg/msg_private.h" -#include "src/simix/smx_process_private.h" +#include "src/simix/ActorImpl.hpp" #include "src/simix/smx_private.h" #include "src/surf/cpu_interface.hpp" #include "simgrid/s4u/host.hpp" diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index 20a3bcf969..11dbb99429 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -6,9 +6,8 @@ #include "xbt/log.h" #include "src/msg/msg_private.h" +#include "src/simix/ActorImpl.hpp" #include "src/simix/smx_network_private.h" -#include "src/simix/smx_process_private.h" - #include "simgrid/s4u/mailbox.hpp" XBT_LOG_EXTERNAL_CATEGORY(s4u); @@ -53,7 +52,7 @@ void Mailbox::setReceiver(ActorPtr actor) { ActorPtr Mailbox::receiver() { if(pimpl_->permanent_receiver == nullptr) return ActorPtr(); - return ActorPtr(&pimpl_->permanent_receiver->actor()); + return ActorPtr(&pimpl_->permanent_receiver->getIface()); } } @@ -68,5 +67,5 @@ int sg_mbox_is_empty(sg_mbox_t mbox) { return mbox->empty(); } void sg_mbox_setReceiver(sg_mbox_t mbox, smx_process_t process) { - mbox->setReceiver(&process->actor()); + mbox->setReceiver(&process->getIface()); } diff --git a/src/simix/smx_process.cpp b/src/simix/ActorImpl.cpp similarity index 99% rename from src/simix/smx_process.cpp rename to src/simix/ActorImpl.cpp index 9d23a075aa..5a454624bd 100644 --- a/src/simix/smx_process.cpp +++ b/src/simix/ActorImpl.cpp @@ -160,7 +160,7 @@ void SIMIX_process_empty_trash() namespace simgrid { namespace simix { -Process::~Process() +ActorImpl::~ActorImpl() { delete this->context; if (this->properties) @@ -175,7 +175,7 @@ void create_maestro(std::function code) { smx_process_t maestro = nullptr; /* Create maestro process and intilialize it */ - maestro = new simgrid::simix::Process(); + maestro = new simgrid::simix::ActorImpl(); maestro->pid = simix_process_maxpid++; maestro->ppid = -1; maestro->name = ""; @@ -260,7 +260,7 @@ smx_process_t SIMIX_process_create( return nullptr; } else { - process = new simgrid::simix::Process(); + process = new simgrid::simix::ActorImpl(); xbt_assert(code && host != nullptr, "Invalid parameters"); /* Process data */ @@ -345,7 +345,7 @@ smx_process_t SIMIX_process_attach( return nullptr; } - smx_process_t process = new simgrid::simix::Process(); + smx_process_t process = new simgrid::simix::ActorImpl(); /* Process data */ process->pid = simix_process_maxpid++; process->name = std::string(name); diff --git a/src/simix/smx_process_private.h b/src/simix/ActorImpl.hpp similarity index 88% rename from src/simix/smx_process_private.h rename to src/simix/ActorImpl.hpp index 2fbbc14c2e..53cb95ac4d 100644 --- a/src/simix/smx_process_private.h +++ b/src/simix/ActorImpl.hpp @@ -1,11 +1,10 @@ -/* Copyright (c) 2007-2010, 2012-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2016. 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 _SIMIX_PROCESS_PRIVATE_H -#define _SIMIX_PROCESS_PRIVATE_H +#ifndef _SIMIX_ACTORIMPL_H +#define _SIMIX_ACTORIMPL_H #include #include @@ -39,9 +38,9 @@ public: bool auto_restart = false; }; -class Process { +class ActorImpl { public: - Process() : actor_(this) {} + ActorImpl() : piface_(this) {} // TODO, replace with boost intrusive container hooks s_xbt_swag_hookup_t process_hookup = { nullptr, nullptr }; /* simix_global->process_list */ @@ -72,16 +71,16 @@ public: std::function code; smx_timer_t kill_timer = nullptr; - int segment_index = 0; /*Reference to an SMPI process' data segment. Default value is -1 if not in SMPI context*/ + int segment_index = 0; /* Reference to an SMPI process' data segment. Default value is -1 if not in SMPI context*/ - friend void intrusive_ptr_add_ref(Process* process) + friend void intrusive_ptr_add_ref(ActorImpl* process) { // Atomic operation! Do not split in two instructions! auto previous = (process->refcount_)++; xbt_assert(previous != 0); (void) previous; } - friend void intrusive_ptr_release(Process* process) + friend void intrusive_ptr_release(ActorImpl* process) { // Atomic operation! Do not split in two instructions! auto count = --(process->refcount_); @@ -89,13 +88,13 @@ public: delete process; } - ~Process(); + ~ActorImpl(); - simgrid::s4u::Actor& actor() { return actor_; } + simgrid::s4u::Actor& getIface() { return piface_; } private: std::atomic_int_fast32_t refcount_ { 1 }; - simgrid::s4u::Actor actor_; + simgrid::s4u::Actor piface_; }; } @@ -103,7 +102,7 @@ private: typedef simgrid::simix::ProcessArg *smx_process_arg_t; -typedef simgrid::simix::Process* smx_process_t; +typedef simgrid::simix::ActorImpl* smx_process_t; SG_BEGIN_DECL() diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 1ecce232e6..c2229a7c9b 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -201,7 +201,7 @@ void SIMIX_global_init(int *argc, char **argv) if (!simix_global) { simix_global = std::unique_ptr(new simgrid::simix::Global()); - simgrid::simix::Process proc; + simgrid::simix::ActorImpl proc; simix_global->process_to_run = xbt_dynar_new(sizeof(smx_process_t), nullptr); simix_global->process_that_ran = xbt_dynar_new(sizeof(smx_process_t), nullptr); simix_global->process_list = xbt_swag_new(xbt_swag_offset(proc, process_hookup)); diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 43365f2923..5d534ba5ef 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -23,7 +23,7 @@ void SIMIX_host_create(sg_host_t host) // FIXME: braindead prototype. Take sg_ho smx_host_priv_t smx_host = xbt_new0(s_smx_host_priv_t, 1); /* Host structure */ - simgrid::simix::Process proc; + simgrid::simix::ActorImpl proc; smx_host->process_list = xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup)); /* Update global variables */ diff --git a/src/simix/smx_network_private.h b/src/simix/smx_network_private.h index fb1e1cf447..630fa4e24c 100644 --- a/src/simix/smx_network_private.h +++ b/src/simix/smx_network_private.h @@ -18,7 +18,7 @@ #include "simgrid/simix.h" #include "popping_private.h" -#include "src/simix/smx_process_private.h" +#include "src/simix/ActorImpl.hpp" namespace simgrid { namespace simix { @@ -35,7 +35,7 @@ public: simgrid::s4u::Mailbox piface_; // Our interface char* name; std::deque comm_queue; - boost::intrusive_ptr permanent_receiver; //process which the mailbox is attached to + boost::intrusive_ptr permanent_receiver; //process which the mailbox is attached to std::deque done_comm_queue;//messages already received in the permanent receive mode }; diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index 108b770ecb..fcb5469858 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -27,7 +27,6 @@ #include "xbt/function_types.h" #include "src/xbt/ex_interface.h" #include "src/instr/instr_private.h" -#include "smx_process_private.h" #include "smx_host_private.h" #include "smx_io_private.h" #include "smx_network_private.h" @@ -35,6 +34,7 @@ #include "smx_synchro_private.h" #include +#include "src/simix/ActorImpl.hpp" #ifdef __cplusplus diff --git a/src/simix/smx_synchro.cpp b/src/simix/smx_synchro.cpp index 93120cb30f..81017c1cff 100644 --- a/src/simix/smx_synchro.cpp +++ b/src/simix/smx_synchro.cpp @@ -102,7 +102,7 @@ Mutex::Mutex() : mutex_(this) { XBT_IN("(%p)", this); // Useful to initialize sleeping swag: - simgrid::simix::Process p; + simgrid::simix::ActorImpl p; this->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup)); XBT_OUT(); } @@ -237,7 +237,7 @@ void simcall_HANDLER_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex) smx_cond_t SIMIX_cond_init(void) { XBT_IN("()"); - simgrid::simix::Process p; + simgrid::simix::ActorImpl p; smx_cond_t cond = new s_smx_cond(); cond->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup)); cond->refcount_ = 1; @@ -393,7 +393,7 @@ void intrusive_ptr_release(s_smx_cond_t *cond) smx_sem_t SIMIX_sem_init(unsigned int value) { XBT_IN("(%u)",value); - simgrid::simix::Process p; + simgrid::simix::ActorImpl p; smx_sem_t sem = xbt_new0(s_smx_sem_t, 1); sem->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup)); diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 2699169b01..f28e62d4a6 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -29,7 +29,7 @@ set(EXTRA_DIST src/simix/smx_io_private.h src/simix/smx_network_private.h src/simix/smx_private.h - src/simix/smx_process_private.h + src/simix/ActorImpl.hpp src/simix/smx_synchro_private.h src/kernel/activity/Synchro.h src/kernel/activity/SynchroComm.hpp @@ -348,7 +348,7 @@ set(SIMIX_SRC src/simix/smx_host.cpp src/simix/smx_io.cpp src/simix/smx_network.cpp - src/simix/smx_process.cpp + src/simix/ActorImpl.cpp src/simix/smx_synchro.cpp src/simix/smx_vm.cpp src/simix/popping.cpp