Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[platf] Kill sg_process_cb
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 30 Nov 2015 09:21:18 +0000 (10:21 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Mon, 30 Nov 2015 10:18:49 +0000 (11:18 +0100)
src/simix/smx_deployment.c
src/surf/sg_platf.cpp

index dfea61f..10574b5 100644 (file)
@@ -15,8 +15,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_deployment, simix,
 
 extern int surf_parse_lineno;
 
-static void parse_process(sg_platf_process_cbarg_t process)
+void sg_platf_new_process(sg_platf_process_cbarg_t process)
 {
+  if (!simix_global)
+    xbt_die("Cannot create process without SIMIX.");
+
   sg_host_t host = sg_host_by_name(process->host);
   if (!host)
     THROWF(arg_error, 0, "Host '%s' unknown", process->host);
@@ -87,9 +90,9 @@ static void parse_process(sg_platf_process_cbarg_t process)
   current_property_set = NULL;
 }
 
-void SIMIX_init_application(void){
+void SIMIX_init_application(void)
+{
   surf_parse_reset_callbacks();
-  sg_platf_process_add_cb(parse_process);
 }
 
 /**
index 8e483c7..d476a19 100644 (file)
@@ -41,8 +41,6 @@ xbt_dynar_t sg_platf_storage_type_cb_list = NULL; // of sg_platf_storage_cb_t
 xbt_dynar_t sg_platf_mstorage_cb_list = NULL; // of sg_platf_storage_cb_t
 xbt_dynar_t sg_platf_mount_cb_list = NULL; // of sg_platf_storage_cb_t
 
-xbt_dynar_t sg_platf_process_cb_list = NULL;
-
 /* ***************************************** */
 /* TUTORIAL: New TAG                         */
 
@@ -87,8 +85,6 @@ void sg_platf_init(void) {
   sg_platf_mstorage_cb_list = xbt_dynar_new(sizeof(sg_platf_storage_cb_t), NULL);
   sg_platf_mount_cb_list = xbt_dynar_new(sizeof(sg_platf_storage_cb_t), NULL);
 
-  sg_platf_process_cb_list = xbt_dynar_new(sizeof(sg_platf_process_cb_t), NULL);
-
   /* ***************************************** */
   /* TUTORIAL: New TAG                         */
 
@@ -122,8 +118,6 @@ void sg_platf_exit(void) {
   xbt_dynar_free(&sg_platf_mstorage_cb_list);
   xbt_dynar_free(&sg_platf_mount_cb_list);
 
-  xbt_dynar_free(&sg_platf_process_cb_list);
-
   /* ***************************************** */
   /* TUTORIAL: New TAG                         */
 
@@ -284,13 +278,6 @@ void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect) {
     fun(trace_connect);
   }
 }
-void sg_platf_new_process(sg_platf_process_cbarg_t process){
-  unsigned int iterator;
-  sg_platf_process_cb_t fun;
-  xbt_dynar_foreach(sg_platf_process_cb_list, iterator, fun) {
-    fun(process);
-  }
-}
 
 void sg_platf_route_begin (sg_platf_route_cbarg_t route){
   route->link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
@@ -444,9 +431,6 @@ void sg_platf_rng_stream_init(unsigned long seed[6]) {
   RngStream_SetPackageSeed(seed);
   sg_platf_rng_stream = RngStream_CreateStream(NULL);
 }
-void sg_platf_process_add_cb(sg_platf_process_cb_t fct) {
-  xbt_dynar_push(sg_platf_process_cb_list, &fct);
-}
 
 RngStream sg_platf_rng_stream_get(const char* id) {
   RngStream stream = NULL;