Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename C++ only header files from .h to .hpp.
[simgrid.git] / src / msg / msg_process.cpp
index 18878b0..27bef10 100644 (file)
@@ -3,9 +3,10 @@
 /* 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 "msg_private.h"
+#include "msg_private.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/simix/ActorImpl.hpp"
+#include "src/simix/smx_private.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)");
 
@@ -304,7 +305,12 @@ msg_process_t MSG_process_from_PID(int PID)
 
 /** @brief returns a list of all currently existing processes */
 xbt_dynar_t MSG_processes_as_dynar() {
-  return SIMIX_processes_as_dynar();
+  xbt_dynar_t res = xbt_dynar_new(sizeof(smx_actor_t), nullptr);
+  for (auto const& kv : simix_global->process_list) {
+    smx_actor_t actor = kv.second;
+    xbt_dynar_push(res, &actor);
+  }
+  return res;
 }
 
 /** @brief Return the current number MSG processes. */
@@ -385,7 +391,7 @@ xbt_dict_t MSG_process_get_properties(msg_process_t process)
       simgrid::simix::kernelImmediate([process] { return process->getImpl()->getProperties(); });
   if (props == nullptr)
     return nullptr;
-  for (auto elm : *props) {
+  for (auto const& elm : *props) {
     xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr);
   }
   return as_dict;