Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
msg_process_from_PID => sg_actor_by_PID
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 4 May 2018 09:05:47 +0000 (11:05 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 4 May 2018 09:05:47 +0000 (11:05 +0200)
include/simgrid/actor.h
include/simgrid/msg.h
src/msg/msg_legacy.cpp
src/msg/msg_process.cpp
src/s4u/s4u_Actor.cpp

index 0cdb36f..ebbc070 100644 (file)
@@ -25,6 +25,7 @@ SG_BEGIN_DECL()
 
 XBT_PUBLIC int sg_actor_get_PID(sg_actor_t actor);
 XBT_PUBLIC int sg_actor_get_PPID(sg_actor_t actor);
+XBT_PUBLIC sg_actor_t sg_actor_by_PID(aid_t pid);
 XBT_PUBLIC const char* sg_actor_get_name(sg_actor_t actor);
 XBT_PUBLIC sg_host_t sg_actor_get_host(sg_actor_t actor);
 XBT_PUBLIC const char* sg_actor_get_property_value(sg_actor_t actor, const char* name);
index abacb70..1ea45bf 100644 (file)
@@ -127,6 +127,7 @@ typedef sg_actor_t msg_process_t;
 
 XBT_PUBLIC int MSG_process_get_PID(msg_process_t process);
 XBT_PUBLIC int MSG_process_get_PPID(msg_process_t process);
+XBT_PUBLIC sg_actor_t MSG_process_from_PID(int pid);
 XBT_PUBLIC const char* MSG_process_get_name(msg_process_t process);
 XBT_PUBLIC sg_host_t MSG_process_get_host(msg_process_t process);
 
@@ -244,7 +245,6 @@ XBT_PUBLIC int MSG_process_killall();
 XBT_PUBLIC void MSG_process_yield();
 
 XBT_PUBLIC void MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup);
-XBT_PUBLIC msg_process_t MSG_process_from_PID(int PID);
 XBT_PUBLIC int MSG_process_self_PID();
 XBT_PUBLIC int MSG_process_self_PPID();
 XBT_PUBLIC const char* MSG_process_self_name();
index 7f65062..304dab0 100644 (file)
@@ -16,6 +16,10 @@ int MSG_process_get_PPID(sg_actor_t actor)
 {
   return sg_actor_get_PPID(actor);
 }
+msg_process_t MSG_process_from_PID(int PID)
+{
+  return sg_actor_by_PID(PID);
+}
 const char* MSG_process_get_name(sg_actor_t actor)
 {
   return sg_actor_get_name(actor);
index c2cdf20..bbadeab 100644 (file)
@@ -242,19 +242,6 @@ XBT_PUBLIC void MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup)
   msg_global->process_data_cleanup = data_cleanup;
 }
 
-/** \ingroup m_process_management
- *
- * \brief Return a #msg_process_t given its PID.
- *
- * This function search in the list of all the created msg_process_t for a msg_process_t  whose PID is equal to \a PID.
- * If no host is found, \c nullptr is returned.
-   Note that the PID are uniq in the whole simulation, not only on a given host.
- */
-msg_process_t MSG_process_from_PID(int PID)
-{
-  return SIMIX_process_from_PID(PID)->ciface();
-}
-
 /** @brief returns a list of all currently existing processes */
 xbt_dynar_t MSG_processes_as_dynar() {
   xbt_dynar_t res = xbt_dynar_new(sizeof(smx_actor_t), nullptr);
index 4523954..e4744b6 100644 (file)
@@ -461,6 +461,19 @@ int sg_actor_get_PPID(sg_actor_t actor)
   return actor->get_ppid();
 }
 
+/** \ingroup m_actor_management
+ *
+ * \brief Return a #sg_actor_t given its PID.
+ *
+ * This function search in the list of all the created sg_actor_t for a sg_actor_t  whose PID is equal to \a PID.
+ * If none is found, \c nullptr is returned.
+   Note that the PID are unique in the whole simulation, not only on a given host.
+ */
+sg_actor_t sg_actor_by_PID(aid_t pid)
+{
+  return simgrid::s4u::Actor::by_pid(pid).get();
+}
+
 /** \ingroup m_actor_management
  * \brief Return the name of an actor.
  */