Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Deprecate MSG_clean
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 2 Oct 2012 08:37:15 +0000 (10:37 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 2 Oct 2012 08:37:15 +0000 (10:37 +0200)
50 files changed:
ChangeLog
examples/msg/actions/actions.c
examples/msg/bittorrent/bittorrent.c
examples/msg/bittorrent/bittorrent_platfgen.c
examples/msg/chord/chord.c
examples/msg/cloud/masterslave_virtual_machines.c
examples/msg/gpu/test_MSG_gpu_task_create.c
examples/msg/gtnets/gtnets.c
examples/msg/icomms/peer.c
examples/msg/icomms/peer2.c
examples/msg/icomms/peer3.c
examples/msg/io/file.c
examples/msg/io/file_unlink.c
examples/msg/kademlia/kademlia.c
examples/msg/masterslave/masterslave_arg.c
examples/msg/masterslave/masterslave_bypass.c
examples/msg/masterslave/masterslave_cluster.c
examples/msg/masterslave/masterslave_console.c
examples/msg/masterslave/masterslave_failure.c
examples/msg/masterslave/masterslave_forwarder.c
examples/msg/masterslave/masterslave_kill.c
examples/msg/masterslave/masterslave_mailbox.c
examples/msg/mc/bugged1.c
examples/msg/migration/migration.c
examples/msg/ns3/ns3.c
examples/msg/parallel_task/parallel_task.c
examples/msg/parallel_task/test_ptask.c
examples/msg/pmm/msg_pmm.c
examples/msg/priority/priority.c
examples/msg/properties/msg_prop.c
examples/msg/sendrecv/sendrecv.c
examples/msg/start_kill_time/sk_time.c
examples/msg/suspend/suspend.c
examples/msg/token_ring/ring_call.c
examples/msg/token_ring/token_bypass.c
examples/msg/tracing/categories.c
examples/msg/tracing/link_srcdst_user_variables.c
examples/msg/tracing/link_user_variables.c
examples/msg/tracing/ms.c
examples/msg/tracing/procmig.c
examples/msg/tracing/simple.c
examples/msg/tracing/trace_platform.c
examples/msg/tracing/user_variables.c
include/msg/msg.h
src/bindings/lua/simgrid_lua.c
src/msg/msg_global.c
teshsuite/msg/get_sender.c
teshsuite/msg/trace/test_trace_integration.c
teshsuite/simdag/platforms/basic_tracing.c
tools/graphicator/graphicator.c

index 0e77800..97393aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,7 +25,8 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    executing comes back (ON_FAILURE="RESTART" on deployment file, 
    MSG_process_auto_restart_set).
  * Use the "msg_" prefix for all datatypes (instead of m_, msg_ and MSG_),
-  please stop using the old ones.
+   please stop using the old ones, they are DEPRECATED.
+ * Deprecate MSG_clean(). No need to call it anymore.
 
  Simix:
  * Bug fixes around the resource failures: don't let the processes
index 4866c34..22e5961 100644 (file)
@@ -589,7 +589,6 @@ int main(int argc, char *argv[])
   res = MSG_action_trace_run(argv[3]);  // it's ok to pass a NULL argument here
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 3679330..e0e4c68 100644 (file)
@@ -32,7 +32,5 @@ int main(int argc, char *argv[])
 
   MSG_main();
 
-  MSG_clean();
-
   return 0;
 }
index ff18530..7147b50 100644 (file)
@@ -138,7 +138,5 @@ int main(int argc, char *argv[])
 
   MSG_main();
 
-  MSG_clean();
-
   return 0;
 }
index 129c79a..5061abd 100644 (file)
@@ -924,7 +924,6 @@ int main(int argc, char *argv[])
   XBT_CRITICAL("Messages created: %ld", smx_total_comms);
   XBT_INFO("Simulated time: %g", MSG_get_clock());
 
-  MSG_clean();
   chord_exit();
 
   if (res == MSG_OK)
index 8e11b09..b0a073a 100644 (file)
@@ -212,7 +212,6 @@ int main(int argc, char *argv[])
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  MSG_clean();
   free(hosts);
   free(hostnames);
   xbt_dynar_free(&hosts_dynar);
index ad78f79..29362af 100644 (file)
@@ -32,8 +32,6 @@ int main(int argc, char *argv[])
 
   XBT_INFO("GPU task %p was created", mytask);
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index defbc80..5236980 100644 (file)
@@ -239,8 +239,6 @@ int main(int argc, char *argv[])
 
   res = test_all(argv[1], argv[2]);
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index cfcfa8d..5ed53e0 100644 (file)
@@ -178,7 +178,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ee1111f..01d03c6 100644 (file)
@@ -131,7 +131,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ae82a7c..a01f2c7 100644 (file)
@@ -165,7 +165,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 6769661..96b70b3 100644 (file)
@@ -89,7 +89,6 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
   if (res == MSG_OK)
     return 0;
   else
index 8a36a78..2d8c5eb 100644 (file)
@@ -121,7 +121,6 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
   if (res == MSG_OK)
     return 0;
   else
index 1f5f732..10c30ce 100644 (file)
@@ -489,7 +489,6 @@ int main(int argc, char *argv[])
 
   XBT_CRITICAL("Messages created: %ld", smx_total_comms);
   XBT_INFO("Simulated time: %g", MSG_get_clock());
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ad3d593..873fedb 100644 (file)
@@ -138,8 +138,6 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index 95bc507..41cb1f8 100644 (file)
@@ -283,7 +283,6 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
   res = test_all();
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 8c02de7..d05ec6a 100644 (file)
@@ -220,7 +220,6 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
   res = test_all(argv[1]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ecefae1..d49df00 100644 (file)
@@ -131,7 +131,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 7292997..6a4f5e3 100644 (file)
@@ -210,7 +210,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 3817018..20f6841 100644 (file)
@@ -214,7 +214,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 85d50d6..bc0a2dc 100644 (file)
@@ -73,7 +73,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   test_all(argv[1], argv[2]);
-  res = MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index d69ed23..73dd03c 100644 (file)
@@ -125,7 +125,6 @@ int main(int argc, char *argv[])
   res = MSG_main();
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 3200fbd..585a1f3 100644 (file)
@@ -66,8 +66,6 @@ int main(int argc, char *argv[])
 
   MSG_main();
 
-  MSG_clean();
-
   return 0;
 
 }
index fc14097..87df498 100644 (file)
@@ -98,9 +98,6 @@ int main(int argc, char *argv[])
   xbt_cond_destroy(cond);
   xbt_mutex_destroy(mutex);
 
-  if (res == MSG_OK)
-    res = MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index 44e213e..6db54f3 100644 (file)
@@ -218,8 +218,6 @@ int main(int argc, char *argv[])
 
   res = test_all(argv[1], argv[2]);
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index 7bd1811..e70aa46 100644 (file)
@@ -101,7 +101,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 5cae522..efe1356 100644 (file)
@@ -164,7 +164,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 4e2157e..f9b9c8d 100644 (file)
@@ -280,8 +280,6 @@ int main(int argc, char *argv[])
 #endif
   XBT_CRITICAL("Simulated time: %g", MSG_get_clock());
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index 958ebfe..f82d132 100644 (file)
@@ -80,7 +80,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
 #ifdef _MSC_VER
   _set_output_format(prev_exponent_format);
index 7c05736..2347d0c 100644 (file)
@@ -135,7 +135,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index bfd7b3b..038697c 100644 (file)
@@ -190,8 +190,6 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Total simulation time: %le", MSG_get_clock());
 
-  MSG_clean();
-
 #ifdef _MSC_VER
   _set_output_format(prev_exponent_format);
 #endif
index af61d37..03bb06b 100644 (file)
@@ -60,7 +60,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   test_all(argv[1], argv[2]);
-  res = MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ea62f62..bdc0085 100644 (file)
@@ -76,7 +76,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   test_all(argv[1], argv[2]);
-  res = MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 94bd2ca..fc60925 100644 (file)
@@ -80,7 +80,6 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
   if (res == MSG_OK)
     return 0;
   else
index 3902008..a5690e7 100644 (file)
@@ -121,7 +121,7 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
+
   if (res == MSG_OK)
     return 0;
   else
index fd5221e..19d993c 100644 (file)
@@ -109,6 +109,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }
index cf228cd..65c0e4c 100644 (file)
@@ -95,6 +95,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }
index 15db60e..46af714 100644 (file)
@@ -87,6 +87,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }
index 532d6f6..69fe71b 100644 (file)
@@ -155,6 +155,5 @@ int main(int argc, char *argv[])
     xbt_dynar_free (&marks);
   }
 
-  MSG_clean();
   return 0;
 }                               /* end_of_main */
index 922495f..25ff189 100644 (file)
@@ -98,6 +98,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }                               /* end_of_main */
index f6c852f..25050e7 100644 (file)
@@ -53,6 +53,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }
index 685a8bf..427a891 100644 (file)
@@ -35,6 +35,5 @@ int main(int argc, char *argv[])
   char *platform_file = argv[1];
   MSG_create_environment(platform_file);
   MSG_main();
-  MSG_clean();
   return 0;
 }
index 1a4e607..65697ff 100644 (file)
@@ -104,7 +104,6 @@ int main(int argc, char *argv[])
   FILE *fp;
   fp = fopen ("triva_graph.plist", "w");
   if (!fp){
-    MSG_clean();
     return 1;
   }
   fprintf (fp, "{\n node = (");
@@ -135,6 +134,5 @@ int main(int argc, char *argv[])
   fprintf (fp, "}\n");
   fclose (fp);
 
-  MSG_clean();
   return 0;
 }
index d11cec3..cfcffee 100644 (file)
@@ -56,7 +56,6 @@ XBT_PUBLIC(void) MSG_config(const char *name, ...);
 
 XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv);
 XBT_PUBLIC(msg_error_t) MSG_main(void);
-XBT_PUBLIC(msg_error_t) MSG_clean(void);
 XBT_PUBLIC(void) MSG_function_register(const char *name,
                                        xbt_main_func_t code);
 XBT_PUBLIC(void) MSG_function_register_default(xbt_main_func_t code);
@@ -294,6 +293,8 @@ XBT_PUBLIC(msg_host_t *) MSG_get_host_table(void);
 #define MSG_process_change_host(h) MSG_process_migrate(MSG_process_self(),h);
 XBT_PUBLIC(msg_error_t) MSG_get_errno(void);
 
+XBT_PUBLIC(msg_error_t) MSG_clean(void);
+
 XBT_PUBLIC(msg_error_t) MSG_task_get(msg_task_t * task, m_channel_t channel);
 XBT_PUBLIC(msg_error_t) MSG_task_get_with_timeout(msg_task_t * task,
                                                   m_channel_t channel,
index 440c562..6eb8d7e 100644 (file)
@@ -185,9 +185,11 @@ static int get_clock(lua_State* L) {
  */
 static int simgrid_gc(lua_State * L)
 {
-  if (sglua_is_maestro(L)) {
-    MSG_clean();
-  }
+  // There is no need to cleanup the C world anymore, as it gets cleaned at system process closing automatically
+  // Maybe at some point we'll want to reintroduce this, for example when encapsulating the simulation properly
+  //if (sglua_is_maestro(L)) {
+  //  MSG_clean();
+  //}
   return 0;
 }
 
index 5e10842..e30aa38 100644 (file)
@@ -18,6 +18,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg,
                                 "Logging specific to MSG (kernel)");
 
 MSG_Global_t msg_global = NULL;
+static void MSG_exit(void);
 
 /********************************* MSG **************************************/
 
@@ -72,6 +73,8 @@ void MSG_init_nocheck(int *argc, char **argv) {
 
   XBT_DEBUG("ADD MSG LEVELS");
   MSG_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __MSG_host_destroy);
+
+  atexit(MSG_exit);
 }
 
 #ifdef MSG_USE_DEPRECATED
@@ -148,10 +151,13 @@ int MSG_process_killall(int reset_PIDs)
 }
 
 /** \ingroup msg_simulation
- * \brief Clean the MSG simulation
+ * \brief Clean the MSG simulation.
+ *
+ * This function is called automatically when the system process stops, so I guess that calling it manually is useless nowadays.
  */
-msg_error_t MSG_clean(void)
-{
+static void MSG_exit(void) {
+  if (msg_global==NULL)
+    return;
   XBT_DEBUG("Closing MSG");
 
 #ifdef HAVE_TRACING
@@ -170,8 +176,6 @@ msg_error_t MSG_clean(void)
   xbt_swag_free(msg_global->vms);
   free(msg_global);
   msg_global = NULL;
-
-  return MSG_OK;
 }
 
 
@@ -187,3 +191,9 @@ unsigned long int MSG_get_sent_msg()
 {
   return msg_global->sent_msg;
 }
+
+#ifdef MSG_USE_DEPRECATED
+msg_error_t MSG_clean(void) {
+  return MSG_OK;
+}
+#endif
index b9ffa48..452fad6 100644 (file)
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
   MSG_create_environment(argv[1]);
   MSG_launch_application(argv[1]);
   res = MSG_main();
-  MSG_clean();
+
   if (res == MSG_OK)
     return 0;
   else
index 4ed7b37..135509b 100644 (file)
@@ -67,8 +67,6 @@ int main(int argc, char *argv[])
   /* Run the example. */
   res = MSG_main();
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index cd2907c..73153ef 100644 (file)
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
+
   if (res == MSG_OK)
     return 0;
   else
index ae54a73..4f24150 100644 (file)
@@ -33,7 +33,6 @@ int main(int argc, char **argv)
   if (status == 0){
     XBT_INFO ("%s expects --cfg=tracing:1 --cfg=tracing/platform:1", argv[0]);
   }
-  MSG_clean();
 #else
   XBT_INFO ("works only if simgrid was compiled with tracing enabled.");
 #endif