From d68dcbd4cd142d73e90ab9376c34a435c10e1dc6 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 9 Apr 2018 22:24:19 +0200 Subject: [PATCH] further snake_case Actor (::this_actor remains) --- examples/s4u/actor-kill/s4u-actor-kill.cpp | 2 +- .../s4u-platform-properties.cpp | 6 +- include/simgrid/s4u/Actor.hpp | 61 +++++++++++++------ include/simgrid/s4u/Mailbox.hpp | 6 +- src/bindings/java/jmsg_process.cpp | 4 +- src/kernel/activity/MailboxImpl.cpp | 2 +- src/mc/remote/Client.cpp | 2 +- src/msg/msg_gos.cpp | 13 ++-- src/msg/msg_process.cpp | 10 +-- src/s4u/s4u_actor.cpp | 38 ++++++------ src/s4u/s4u_comm.cpp | 8 +-- src/smpi/internals/smpi_global.cpp | 2 +- src/smpi/internals/smpi_process.cpp | 8 +-- src/smpi/mpi/smpi_comm.cpp | 4 +- src/smpi/mpi/smpi_request.cpp | 12 ++-- teshsuite/s4u/actor/actor.cpp | 4 +- teshsuite/s4u/pid/pid.cpp | 4 +- 17 files changed, 110 insertions(+), 76 deletions(-) diff --git a/examples/s4u/actor-kill/s4u-actor-kill.cpp b/examples/s4u/actor-kill/s4u-actor-kill.cpp index fb1efa624e..f2dd73d4a7 100644 --- a/examples/s4u/actor-kill/s4u-actor-kill.cpp +++ b/examples/s4u/actor-kill/s4u-actor-kill.cpp @@ -60,7 +60,7 @@ static void killer() simgrid::s4u::this_actor::sleep_for(1); XBT_INFO("Killing everybody but myself"); - simgrid::s4u::Actor::killAll(); + simgrid::s4u::Actor::kill_all(); XBT_INFO("OK, goodbye now. I commit a suicide."); simgrid::s4u::this_actor::kill(); diff --git a/examples/s4u/platform-properties/s4u-platform-properties.cpp b/examples/s4u/platform-properties/s4u-platform-properties.cpp index 05a510ef16..d04311c98b 100644 --- a/examples/s4u/platform-properties/s4u-platform-properties.cpp +++ b/examples/s4u/platform-properties/s4u-platform-properties.cpp @@ -78,7 +78,7 @@ static int bob(int argc, char* argv[]) XBT_INFO(" Zone property: author -> %s", root->getProperty("author")); /* Get the property list of current bob process */ - std::map* props = simgrid::s4u::Actor::self()->getProperties(); + std::map* props = simgrid::s4u::Actor::self()->get_properties(); const char* noexist = "UnknownProcessProp"; XBT_ATTRIB_UNUSED const char* value; @@ -88,8 +88,8 @@ static int bob(int argc, char* argv[]) XBT_INFO("== Try to get an actor property that does not exist"); - value = simgrid::s4u::Actor::self()->getProperty(noexist); - xbt_assert(not value, "The property is defined (it shouldnt)"); + value = simgrid::s4u::Actor::self()->get_property(noexist); + xbt_assert(not value, "The property is defined (it should not)"); return 0; } diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index 87e2f596b6..22a519998d 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -213,11 +213,11 @@ public: /** Retrieves the PID of that actor * * aid_t is an alias for long */ - aid_t get_pid(); + aid_t get_pid() const; /** Retrieves the PPID of that actor * * aid_t is an alias for long */ - aid_t get_ppid(); + aid_t get_ppid() const; /** Suspend an actor by suspending the task on which it was waiting for the completion. */ void suspend(); @@ -228,20 +228,20 @@ public: void yield(); /** Returns true if the actor is suspended. */ - int isSuspended(); + int is_suspended(); /** If set to true, the actor will automatically restart when its host reboots */ - void setAutoRestart(bool autorestart); + void set_auto_restart(bool autorestart); /** Add a function to the list of "on_exit" functions for the current actor. The on_exit functions are the functions * executed when your actor is killed. You should use them to free the data used by your actor. */ - void onExit(int_f_pvoid_pvoid_t fun, void* data); + void on_exit(int_f_pvoid_pvoid_t fun, void* data); /** Sets the time at which that actor should be killed */ - void setKillTime(double time); + void set_kill_time(double time); /** Retrieves the time at which that actor will be killed (or -1 if not set) */ - double getKillTime(); + double get_kill_time(); void migrate(Host * new_host); @@ -258,7 +258,7 @@ public: static void kill(aid_t pid); /** Retrieves the actor that have the given PID (or nullptr if not existing) */ - static ActorPtr byPid(aid_t pid); + static ActorPtr by_pid(aid_t pid); /** @brief Wait for the actor to finish. * @@ -266,21 +266,18 @@ public: */ void join(); void join(double timeout); - - // Static methods on all actors: + Actor* restart(); /** Ask kindly to all actors to die. Only the issuer will survive. */ - static void killAll(); - static void killAll(int resetPid); + static void kill_all(); /** Returns the internal implementation of this actor */ - kernel::actor::ActorImpl* getImpl(); + kernel::actor::ActorImpl* get_impl(); /** Retrieve the property value (or nullptr if not set) */ - std::map* getProperties(); - const char* getProperty(const char* key); - void setProperty(const char* key, const char* value); - Actor* restart(); + std::map* get_properties(); // FIXME: do not export the map, but only the keys or something + const char* get_property(const char* key); + void set_property(const char* key, const char* value); XBT_ATTRIB_DEPRECATED_v323("Please use Actor::create()") static ActorPtr createActor(const char* name, s4u::Host* host, std::function code) @@ -313,6 +310,36 @@ public: XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_host()") Host* getHost() { return get_host(); } XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_pid()") aid_t getPid() { return get_pid(); } XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_ppid()") aid_t getPpid() { return get_ppid(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::is_suspended()") int isSuspended() { return is_suspended(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::set_auto_restart()") void setAutoRestart(bool a) + { + set_auto_restart(a); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::on_exit()") void onExit(int_f_pvoid_pvoid_t fun, void* data) + { + on_exit(fun, data); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::set_kill_time()") void setKillTime(double time) { set_kill_time(time); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_kill_time()") double getKillTime() { return get_kill_time(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::by_pid()") static ActorPtr byPid(aid_t pid) { return by_pid(pid); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::kill_all()") static void killAll() { kill_all(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::kill_all() with no parameter") static void killAll(int resetPid) + { + kill_all(); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_impl()") kernel::actor::ActorImpl* getImpl() { return get_impl(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_property()") const char* getProperty(const char* key) + { + return get_property(key); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_properties()") std::map* getProperties() + { + return get_properties(); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_properties()") void setProperty(const char* key, const char* value) + { + set_property(key, value); + } }; /** @ingroup s4u_api diff --git a/include/simgrid/s4u/Mailbox.hpp b/include/simgrid/s4u/Mailbox.hpp index 827bc8a19c..f27b582a5b 100644 --- a/include/simgrid/s4u/Mailbox.hpp +++ b/include/simgrid/s4u/Mailbox.hpp @@ -118,13 +118,17 @@ class XBT_PUBLIC Mailbox { friend void intrusive_ptr_release(Mailbox*) {} public: /** private function, do not use. FIXME: make me protected */ - kernel::activity::MailboxImpl* getImpl() { return pimpl_; } + kernel::activity::MailboxImpl* get_impl() { return pimpl_; } XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_name()") const simgrid::xbt::string& getName() const { return get_name(); } XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_cname()") const char* getCname() const { return get_cname(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_impl()") kernel::activity::MailboxImpl* getImpl() + { + return get_impl(); + } /** @brief Retrieves the name of that mailbox as a C++ string */ const simgrid::xbt::string& get_name() const; diff --git a/src/bindings/java/jmsg_process.cpp b/src/bindings/java/jmsg_process.cpp index a25eb46cf2..edc2a4ba15 100644 --- a/src/bindings/java/jmsg_process.cpp +++ b/src/bindings/java/jmsg_process.cpp @@ -195,7 +195,7 @@ JNICALL Java_org_simgrid_msg_Process_setAutoRestart (JNIEnv *env, jobject jproce return; } - process->setAutoRestart(jauto_restart == JNI_TRUE); + process->set_auto_restart(jauto_restart == JNI_TRUE); } JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_restart (JNIEnv *env, jobject jprocess) { @@ -219,7 +219,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended(JNIEnv * env } /* true is the process is suspended, false otherwise */ - return (jboolean)process->isSuspended(); + return (jboolean)process->is_suspended(); } JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep(JNIEnv *env, jclass cls, jlong jmillis, jint jnanos) diff --git a/src/kernel/activity/MailboxImpl.cpp b/src/kernel/activity/MailboxImpl.cpp index d07fe998f6..d859649af9 100644 --- a/src/kernel/activity/MailboxImpl.cpp +++ b/src/kernel/activity/MailboxImpl.cpp @@ -54,7 +54,7 @@ MailboxImpl* MailboxImpl::byNameOrCreate(const char* name) void MailboxImpl::setReceiver(s4u::ActorPtr actor) { if (actor != nullptr) - this->permanent_receiver = actor.get()->getImpl(); + this->permanent_receiver = actor.get()->get_impl(); else this->permanent_receiver = nullptr; } diff --git a/src/mc/remote/Client.cpp b/src/mc/remote/Client.cpp index 9c741c4a35..4d009a3dc9 100644 --- a/src/mc/remote/Client.cpp +++ b/src/mc/remote/Client.cpp @@ -114,7 +114,7 @@ void Client::handleSimcall(s_mc_message_simcall_handle_t* message) void Client::handleRestore(s_mc_message_restore_t* message) { #if HAVE_SMPI - smpi_really_switch_data_segment(simgrid::s4u::Actor::byPid(message->index)); + smpi_really_switch_data_segment(simgrid::s4u::Actor::by_pid(message->index)); #endif } void Client::handleActorEnabled(s_mc_message_actor_enabled_t* msg) diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index 970a0fc3d5..5415b72404 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -279,7 +279,8 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, d /* Try to receive it by calling SIMIX network layer */ try { - simcall_comm_recv(MSG_process_self()->getImpl(), mailbox->getImpl(), task, nullptr, nullptr, nullptr, nullptr, timeout, rate); + simcall_comm_recv(MSG_process_self()->get_impl(), mailbox->get_impl(), task, nullptr, nullptr, nullptr, nullptr, + timeout, rate); XBT_DEBUG("Got task %s from %s", (*task)->name, mailbox->get_cname()); (*task)->simdata->setNotUsed(); } @@ -325,7 +326,7 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char* al /* Send it by calling SIMIX network layer */ smx_activity_t act = - simcall_comm_isend(myself->getImpl(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate, task, + simcall_comm_isend(myself->get_impl(), mailbox->get_impl(), t_simdata->bytes_amount, t_simdata->rate, task, sizeof(void*), nullptr, cleanup, nullptr, nullptr, detached); t_simdata->comm = boost::static_pointer_cast(act); @@ -461,9 +462,9 @@ msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, double rat XBT_CRITICAL("MSG_task_irecv() was asked to write in a non empty task struct."); /* Try to receive it by calling SIMIX network layer */ - msg_comm_t comm = - new simgrid::msg::Comm(nullptr, task, simcall_comm_irecv(SIMIX_process_self(), mbox->getImpl(), task, nullptr, - nullptr, nullptr, nullptr, rate)); + msg_comm_t comm = new simgrid::msg::Comm( + nullptr, task, + simcall_comm_irecv(SIMIX_process_self(), mbox->get_impl(), task, nullptr, nullptr, nullptr, nullptr, rate)); return comm; } @@ -794,7 +795,7 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl /* Try to send it by calling SIMIX network layer */ try { smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simix call */ - comm = simcall_comm_isend(SIMIX_process_self(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate, task, + comm = simcall_comm_isend(SIMIX_process_self(), mailbox->get_impl(), t_simdata->bytes_amount, t_simdata->rate, task, sizeof(void*), nullptr, nullptr, nullptr, nullptr, 0); if (TRACE_is_enabled()) simcall_set_category(comm, task->category); diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index 94f03ff44f..ce9f382795 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -57,7 +57,7 @@ smx_actor_t MSG_process_create_from_SIMIX(const char* name, std::functiongetImpl(); + return p == nullptr ? nullptr : p->get_impl(); } /** \ingroup m_process_management @@ -212,7 +212,7 @@ void* MSG_process_get_data(msg_process_t process) xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); /* get from SIMIX the MSG process data, and then the user data */ - simgrid::msg::ActorExt* msgExt = (simgrid::msg::ActorExt*)process->getImpl()->userdata; + simgrid::msg::ActorExt* msgExt = (simgrid::msg::ActorExt*)process->get_impl()->userdata; if (msgExt) return msgExt->data; else @@ -228,7 +228,7 @@ msg_error_t MSG_process_set_data(msg_process_t process, void *data) { xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); - static_cast(process->getImpl()->userdata)->data = data; + static_cast(process->get_impl()->userdata)->data = data; return MSG_OK; } @@ -311,7 +311,7 @@ msg_process_t MSG_process_self() } smx_context_t MSG_process_get_smx_ctx(msg_process_t process) { // deprecated -- smx_context_t should die afterward - return process->getImpl()->context; + return process->get_impl()->context; } /** * \ingroup m_process_management @@ -329,7 +329,7 @@ void MSG_process_on_exit(int_f_pvoid_pvoid_t fun, void *data) { */ XBT_PUBLIC void MSG_process_auto_restart_set(msg_process_t process, int auto_restart) { - process->setAutoRestart(auto_restart); + process->set_auto_restart(auto_restart); } /** @ingroup m_process_management diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 4ed7584c77..f0d1a57bc0 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -61,11 +61,12 @@ void Actor::join(double timeout) simcall_process_join(this->pimpl_, timeout); } -void Actor::setAutoRestart(bool autorestart) { +void Actor::set_auto_restart(bool autorestart) +{ simgrid::simix::kernelImmediate([this, autorestart]() { pimpl_->auto_restart = autorestart; }); } -void Actor::onExit(int_f_pvoid_pvoid_t fun, void* data) +void Actor::on_exit(int_f_pvoid_pvoid_t fun, void* data) { simcall_process_on_exit(pimpl_, fun, data); } @@ -143,12 +144,12 @@ const char* Actor::get_cname() const return this->pimpl_->get_cname(); } -aid_t Actor::get_pid() +aid_t Actor::get_pid() const { return this->pimpl_->pid; } -aid_t Actor::get_ppid() +aid_t Actor::get_ppid() const { return this->pimpl_->ppid; } @@ -168,17 +169,18 @@ void Actor::resume() simgrid::instr::Container::byName(instr_pid(this))->getState("ACTOR_STATE")->popEvent(); } -int Actor::isSuspended() +int Actor::is_suspended() { return simgrid::simix::kernelImmediate([this] { return pimpl_->suspended; }); } -void Actor::setKillTime(double time) { +void Actor::set_kill_time(double time) +{ simcall_process_set_kill_time(pimpl_,time); } /** \brief Get the kill time of an actor(or 0 if unset). */ -double Actor::getKillTime() +double Actor::get_kill_time() { return SIMIX_timer_get_date(pimpl_->kill_timer); } @@ -202,14 +204,14 @@ void Actor::kill() { [this, process] { SIMIX_process_kill(pimpl_, (pimpl_ == simix_global->maestro_process) ? pimpl_ : process); }); } -smx_actor_t Actor::getImpl() +smx_actor_t Actor::get_impl() { return pimpl_; } // ***** Static functions ***** -ActorPtr Actor::byPid(aid_t pid) +ActorPtr Actor::by_pid(aid_t pid) { smx_actor_t process = SIMIX_process_from_PID(pid); if (process != nullptr) @@ -218,23 +220,23 @@ ActorPtr Actor::byPid(aid_t pid) return ActorPtr(); } -void Actor::killAll() +void Actor::kill_all() { simcall_process_killall(); } -std::map* Actor::getProperties() +std::map* Actor::get_properties() { return simgrid::simix::kernelImmediate([this] { return this->pimpl_->getProperties(); }); } /** Retrieve the property value (or nullptr if not set) */ -const char* Actor::getProperty(const char* key) +const char* Actor::get_property(const char* key) { return simgrid::simix::kernelImmediate([this, key] { return pimpl_->getProperty(key); }); } -void Actor::setProperty(const char* key, const char* value) +void Actor::set_property(const char* key, const char* value) { simgrid::simix::kernelImmediate([this, key, value] { pimpl_->setProperty(key, value); }); } @@ -406,7 +408,7 @@ int 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 */ - if (actor == nullptr || actor->getImpl() == nullptr) + if (actor == nullptr || actor->get_impl() == nullptr) return 0; return actor->get_pid(); } @@ -444,7 +446,7 @@ sg_host_t sg_actor_get_host(sg_actor_t actor) */ const char* sg_actor_get_property_value(sg_actor_t actor, const char* name) { - return actor->getProperty(name); + return actor->get_property(name); } /** \ingroup m_actor_management @@ -456,7 +458,7 @@ xbt_dict_t sg_actor_get_properties(sg_actor_t actor) { xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr"); xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f); - std::map* props = actor->getProperties(); + std::map* props = actor->get_properties(); if (props == nullptr) return nullptr; for (auto const& elm : *props) { @@ -494,7 +496,7 @@ void sg_actor_resume(sg_actor_t actor) */ int sg_actor_is_suspended(sg_actor_t actor) { - return actor->isSuspended(); + return actor->is_suspended(); } /** @@ -548,5 +550,5 @@ void sg_actor_kill(sg_actor_t actor) */ void sg_actor_set_kill_time(sg_actor_t actor, double kill_time) { - actor->setKillTime(kill_time); + actor->set_kill_time(kill_time); } diff --git a/src/s4u/s4u_comm.cpp b/src/s4u/s4u_comm.cpp index 7287f7848a..9e068cca7b 100644 --- a/src/s4u/s4u_comm.cpp +++ b/src/s4u/s4u_comm.cpp @@ -80,11 +80,11 @@ Activity* Comm::start() xbt_assert(state_ == State::inited); if (srcBuff_ != nullptr) { // Sender side - pimpl_ = simcall_comm_isend(sender_, mailbox_->getImpl(), remains_, rate_, srcBuff_, srcBuffSize_, matchFunction_, + pimpl_ = simcall_comm_isend(sender_, mailbox_->get_impl(), remains_, rate_, srcBuff_, srcBuffSize_, matchFunction_, cleanFunction_, copyDataFunction_, user_data_, detached_); } else if (dstBuff_ != nullptr) { // Receiver side xbt_assert(not detached_, "Receive cannot be detached"); - pimpl_ = simcall_comm_irecv(receiver_, mailbox_->getImpl(), dstBuff_, &dstBuffSize_, matchFunction_, + pimpl_ = simcall_comm_irecv(receiver_, mailbox_->get_impl(), dstBuff_, &dstBuffSize_, matchFunction_, copyDataFunction_, user_data_, rate_); } else { @@ -114,10 +114,10 @@ Activity* Comm::wait(double timeout) case State::inited: // It's not started yet. Do it in one simcall if (srcBuff_ != nullptr) { - simcall_comm_send(sender_, mailbox_->getImpl(), remains_, rate_, srcBuff_, srcBuffSize_, matchFunction_, + simcall_comm_send(sender_, mailbox_->get_impl(), remains_, rate_, srcBuff_, srcBuffSize_, matchFunction_, copyDataFunction_, user_data_, timeout); } else { // Receiver - simcall_comm_recv(receiver_, mailbox_->getImpl(), dstBuff_, &dstBuffSize_, matchFunction_, copyDataFunction_, + simcall_comm_recv(receiver_, mailbox_->get_impl(), dstBuff_, &dstBuffSize_, matchFunction_, copyDataFunction_, user_data_, timeout, rate_); } state_ = State::finished; diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index ebf13d8d52..de0b17cdda 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -96,7 +96,7 @@ simgrid::smpi::Process* smpi_process() ActorPtr me = Actor::self(); if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...) return nullptr; - simgrid::msg::ActorExt* msgExt = static_cast(me->getImpl()->userdata); + simgrid::msg::ActorExt* msgExt = static_cast(me->get_impl()->userdata); return static_cast(msgExt->data); } diff --git a/src/smpi/internals/smpi_process.cpp b/src/smpi/internals/smpi_process.cpp index eda3a6857f..e391eee9c0 100644 --- a/src/smpi/internals/smpi_process.cpp +++ b/src/smpi/internals/smpi_process.cpp @@ -69,7 +69,7 @@ void Process::set_data(int* argc, char*** argv) finalization_barrier_ = barrier; process_ = simgrid::s4u::Actor::self(); - static_cast(process_->getImpl()->userdata)->data = this; + static_cast(process_->get_impl()->userdata)->data = this; if (*argc > 3) { memmove(&(*argv)[0], &(*argv)[2], sizeof(char*) * (*argc - 2)); @@ -168,12 +168,12 @@ MPI_Comm Process::comm_world() smx_mailbox_t Process::mailbox() { - return mailbox_->getImpl(); + return mailbox_->get_impl(); } smx_mailbox_t Process::mailbox_small() { - return mailbox_small_->getImpl(); + return mailbox_small_->get_impl(); } xbt_mutex_t Process::mailboxes_mutex() @@ -249,7 +249,7 @@ void Process::init(int *argc, char ***argv){ } if (argc != nullptr && argv != nullptr) { simgrid::s4u::ActorPtr proc = simgrid::s4u::Actor::self(); - proc->getImpl()->context->set_cleanup(&MSG_process_cleanup_from_SIMIX); + proc->get_impl()->context->set_cleanup(&MSG_process_cleanup_from_SIMIX); char* instance_id = (*argv)[1]; try { diff --git a/src/smpi/mpi/smpi_comm.cpp b/src/smpi/mpi/smpi_comm.cpp index b50587d170..af7bd41886 100644 --- a/src/smpi/mpi/smpi_comm.cpp +++ b/src/smpi/mpi/smpi_comm.cpp @@ -370,7 +370,7 @@ void Comm::init_smp(){ if(MPI_COMM_WORLD!=MPI_COMM_UNINITIALIZED && this!=MPI_COMM_WORLD){ //create leader_communicator for (i=0; i< leader_group_size;i++) - leaders_group->set_mapping(simgrid::s4u::Actor::byPid(leader_list[i]), i); + leaders_group->set_mapping(simgrid::s4u::Actor::by_pid(leader_list[i]), i); leader_comm = new Comm(leaders_group, nullptr); this->set_leaders_comm(leader_comm); this->set_intra_comm(comm_intra); @@ -378,7 +378,7 @@ void Comm::init_smp(){ // create intracommunicator }else{ for (i=0; i< leader_group_size;i++) - leaders_group->set_mapping(simgrid::s4u::Actor::byPid(leader_list[i]), i); + leaders_group->set_mapping(simgrid::s4u::Actor::by_pid(leader_list[i]), i); if(this->get_leaders_comm()==MPI_COMM_NULL){ leader_comm = new Comm(leaders_group, nullptr); diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index b8fa3dbcfa..5739c1c382 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -343,7 +343,7 @@ void Request::start() if ((flags_ & RECV) != 0) { this->print_request("New recv"); - simgrid::smpi::Process* process = smpi_process_remote(simgrid::s4u::Actor::byPid(dst_)); + simgrid::smpi::Process* process = smpi_process_remote(simgrid::s4u::Actor::by_pid(dst_)); int async_small_thresh = xbt_cfg_get_int("smpi/async-small-thresh"); @@ -388,14 +388,14 @@ void Request::start() // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later real_size_=size_; action_ = simcall_comm_irecv( - process->process()->getImpl(), mailbox, buf_, &real_size_, &match_recv, + process->process()->get_impl(), mailbox, buf_, &real_size_, &match_recv, process->replaying() ? &smpi_comm_null_copy_buffer_callback : smpi_comm_copy_data_callback, this, -1.0); XBT_DEBUG("recv simcall posted"); if (async_small_thresh != 0 || (flags_ & RMA) != 0 ) xbt_mutex_release(mut); } else { /* the RECV flag was not set, so this is a send */ - simgrid::smpi::Process* process = smpi_process_remote(simgrid::s4u::Actor::byPid(dst_)); + simgrid::smpi::Process* process = smpi_process_remote(simgrid::s4u::Actor::by_pid(dst_)); int rank = src_; if (TRACE_smpi_view_internals()) { TRACE_smpi_send(rank, rank, dst_, tag_, size_); @@ -416,7 +416,7 @@ void Request::start() (static_cast(buf_) >= smpi_data_exe_start) && (static_cast(buf_) < smpi_data_exe_start + smpi_data_exe_size)) { XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment "); - smpi_switch_data_segment(simgrid::s4u::Actor::byPid(src_)); + smpi_switch_data_segment(simgrid::s4u::Actor::by_pid(src_)); } buf = xbt_malloc(size_); memcpy(buf,oldbuf,size_); @@ -476,7 +476,7 @@ void Request::start() // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later real_size_=size_; action_ = simcall_comm_isend( - simgrid::s4u::Actor::byPid(src_)->getImpl(), mailbox, size_, -1.0, buf, real_size_, &match_send, + simgrid::s4u::Actor::by_pid(src_)->get_impl(), mailbox, size_, -1.0, buf, real_size_, &match_send, &xbt_free_f, // how to free the userdata if a detached send fails not process->replaying() ? smpi_comm_copy_data_callback : &smpi_comm_null_copy_buffer_callback, this, // detach if msg size < eager/rdv switch limit @@ -644,7 +644,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* if (smpi_iprobe_sleep > 0) { smx_activity_t iprobe_sleep = simcall_execution_start( "iprobe", /* flops to executek*/ nsleeps * smpi_iprobe_sleep * speed * maxrate, /* priority */ 1.0, - /* performance bound */ maxrate * speed, smpi_process()->process()->getImpl()->host); + /* performance bound */ maxrate * speed, smpi_process()->process()->get_impl()->host); simcall_execution_wait(iprobe_sleep); } // behave like a receive, but don't do it diff --git a/teshsuite/s4u/actor/actor.cpp b/teshsuite/s4u/actor/actor.cpp index 259f917489..ccf99d53f6 100644 --- a/teshsuite/s4u/actor/actor.cpp +++ b/teshsuite/s4u/actor/actor.cpp @@ -38,13 +38,13 @@ static void master() XBT_INFO("Suspend Actor (pid=%ld)", actor->get_pid()); actor->suspend(); - XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->get_pid(), actor->isSuspended() ? "" : "not "); + XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->get_pid(), actor->is_suspended() ? "" : "not "); simgrid::s4u::this_actor::sleep_for(2); XBT_INFO("Resume Actor (pid=%ld)", actor->get_pid()); actor->resume(); - XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->get_pid(), actor->isSuspended() ? "" : "not "); + XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->get_pid(), actor->is_suspended() ? "" : "not "); simgrid::s4u::this_actor::sleep_for(2); actor->kill(); diff --git a/teshsuite/s4u/pid/pid.cpp b/teshsuite/s4u/pid/pid.cpp index 881bcbe52f..1d70216cbd 100644 --- a/teshsuite/s4u/pid/pid.cpp +++ b/teshsuite/s4u/pid/pid.cpp @@ -33,7 +33,7 @@ static void killall() for (int i = 0; i < 3; i++) { int* pid = static_cast(mailbox->get()); XBT_INFO("Killing process \"%d\".", *pid); - simgrid::s4u::Actor::byPid(*pid)->kill(); + simgrid::s4u::Actor::by_pid(*pid)->kill(); } } @@ -42,7 +42,7 @@ int main(int argc, char* argv[]) simgrid::s4u::Engine e(&argc, argv); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::killAll(); + simgrid::s4u::Actor::kill_all(); simgrid::s4u::Actor::create("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid); simgrid::s4u::Actor::create("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid); -- 2.20.1