Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
another dynar dies
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 14 Sep 2016 19:43:42 +0000 (21:43 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 14 Sep 2016 19:43:42 +0000 (21:43 +0200)
src/simix/smx_host.cpp
src/simix/smx_host_private.h
src/surf/sg_platf.cpp

index 7eaf2bb..9537df4 100644 (file)
@@ -49,7 +49,9 @@ namespace simgrid {
       for (auto arg : auto_restart_processes)
         delete arg;
       auto_restart_processes.clear();
-      xbt_dynar_free(&boot_processes);
+      for (auto arg : boot_processes)
+        delete arg;
+      boot_processes.clear();
       xbt_swag_free(process_list);
     }
 
@@ -59,9 +61,7 @@ namespace simgrid {
      */
     void Host::turnOn()
     {
-      unsigned int cpt;
-      smx_process_arg_t arg;
-      xbt_dynar_foreach(boot_processes,cpt,arg) {
+      for (auto arg : boot_processes) {
         XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->hostname);
         simix_global->create_process_function(arg->name.c_str(),
             arg->code,
index 7d3fd3d..964a730 100644 (file)
@@ -32,7 +32,7 @@ namespace simgrid {
 
       xbt_swag_t process_list;
       std::vector<ProcessArg*> auto_restart_processes;
-      xbt_dynar_t boot_processes = nullptr;
+      std::vector<ProcessArg*> boot_processes;
 
       void turnOn();
     };
index 5bfa669..dfcb753 100644 (file)
@@ -595,10 +595,8 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process)
   arg->hostname = sg_host_get_name(host);
   arg->kill_time = kill_time;
   arg->properties = current_property_set;
-  if (!sg_host_simix(host)->boot_processes)
-    sg_host_simix(host)->boot_processes = xbt_dynar_new(sizeof(smx_process_arg_t), _SIMIX_host_free_process_arg);
 
-  xbt_dynar_push_as(sg_host_simix(host)->boot_processes,smx_process_arg_t,arg);
+  sg_host_simix(host)->boot_processes.push_back(arg);
 
   if (start_time > SIMIX_get_clock()) {