From: Martin Quinson Date: Wed, 15 Feb 2017 23:15:10 +0000 (+0100) Subject: don't hide the C++, deal with it X-Git-Tag: v3_15~368 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/fea7b904d6663cc649e9114c579ed347c4677ef8 don't hide the C++, deal with it --- diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 0808f663ce..eac85bf036 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -32,9 +32,6 @@ XBT_PUBLIC(void*) sg_host_user(sg_host_t host); XBT_PUBLIC(void) sg_host_user_set(sg_host_t host, void* userdata); XBT_PUBLIC(void) sg_host_user_destroy(sg_host_t host); -// ========== Simix layer ============= -XBT_PUBLIC(smx_host_priv_t) sg_host_simix(sg_host_t host); - // ========= storage related functions ============ XBT_PUBLIC(xbt_dict_t) sg_host_get_mounted_storage_list(sg_host_t host); XBT_PUBLIC(xbt_dynar_t) sg_host_get_attached_storage_list(sg_host_t host); diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 977068ce62..2a364a7a9a 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -116,11 +116,6 @@ void sg_host_user_destroy(sg_host_t host) { host->extension_set(USER_HOST_LEVEL, nullptr); } -// ========== Simix layer ============= -smx_host_priv_t sg_host_simix(sg_host_t host){ - return host->extension(); -} - // ========= storage related functions ============ xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){ return host->pimpl_->getMountedStorageList(); diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 469386d11e..7ae8a534db 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -135,7 +135,7 @@ void SIMIX_process_cleanup(smx_actor_t process) XBT_DEBUG("%p should not be run anymore",process); simix_global->process_list.erase(process->pid); if (process->host) - xbt_swag_remove(process, sg_host_simix(process->host)->process_list); + xbt_swag_remove(process, process->host->extension()->process_list); xbt_swag_insert(process, simix_global->process_to_destroy); process->context->iwannadie = 0; @@ -274,7 +274,7 @@ smx_actor_t SIMIX_process_create( process->properties = properties; /* Add the process to it's host process list */ - xbt_swag_insert(process, sg_host_simix(host)->process_list); + xbt_swag_insert(process, host->extension()->process_list); XBT_DEBUG("Start context '%s'", process->name.c_str()); @@ -354,7 +354,7 @@ smx_actor_t SIMIX_process_attach( process->properties = properties; /* Add the process to it's host process list */ - xbt_swag_insert(process, sg_host_simix(host)->process_list); + xbt_swag_insert(process, host->extension()->process_list); /* Now insert it in the global process list and in the process to run list */ simix_global->process_list[process->pid] = process; @@ -559,9 +559,9 @@ void simcall_HANDLER_process_set_host(smx_simcall_t simcall, smx_actor_t process void SIMIX_process_change_host(smx_actor_t process, sg_host_t dest) { xbt_assert((process != nullptr), "Invalid parameters"); - xbt_swag_remove(process, sg_host_simix(process->host)->process_list); + xbt_swag_remove(process, process->host->extension()->process_list); process->host = dest; - xbt_swag_insert(process, sg_host_simix(dest)->process_list); + xbt_swag_insert(process, dest->extension()->process_list); } diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index dab3c2221d..1e5791c847 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -75,7 +75,7 @@ namespace simgrid { /** @brief Stop the host if it is on */ void SIMIX_host_off(sg_host_t h, smx_actor_t issuer) { - smx_host_priv_t host = sg_host_simix(h); + smx_host_priv_t host = h->extension(); xbt_assert((host != nullptr), "Invalid parameters"); @@ -140,17 +140,15 @@ void SIMIX_host_add_auto_restart_process( xbt_dict_set(watched_hosts_lib, host->cname(), host, nullptr); XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF", host->cname()); } - sg_host_simix(host)->auto_restart_processes.push_back(arg); + host->extension()->auto_restart_processes.push_back(arg); } /** @brief Restart the list of processes that have been registered to the host */ void SIMIX_host_autorestart(sg_host_t host) { - std::vector process_list = sg_host_simix(host)->auto_restart_processes; - if (process_list.empty()) - return; + std::vector process_list = + host->extension()->auto_restart_processes; for (auto arg : process_list) { - XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->cname()); simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host, arg->kill_time, arg->properties, arg->auto_restart, nullptr); diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index ac3ce92a35..7b0efe7da5 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -507,7 +507,7 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process) arg->kill_time = kill_time; arg->properties = current_property_set; - sg_host_simix(host)->boot_processes.push_back(arg); + host->extension()->boot_processes.push_back(arg); if (start_time > SIMIX_get_clock()) {