Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Replace redundant type with "auto" (src/smpi/).
[simgrid.git] / src / s4u / s4u_Host.cpp
index a4aad5cccfb03c89f51ec0a3a0d1105d564ceb64..3dba929a30d991df2c98fb75b758a38825ce72c2 100644 (file)
@@ -287,23 +287,24 @@ std::vector<const char*> Host::get_attached_storages() const
 
 std::unordered_map<std::string, Storage*> const& Host::get_mounted_storages()
 {
-  if (mounts_ == nullptr)
-    mounts_ = pimpl_->get_mounted_storages();
-
+  kernel::actor::simcall([this] {
+    if (mounts_ == nullptr)
+      mounts_ = pimpl_->get_mounted_storages();
+  });
   return *mounts_;
 }
 
-ExecPtr Host::exec_async(double flops)
+ExecPtr Host::exec_async(double flops) const
 {
   return this_actor::exec_init(flops);
 }
 
-void Host::execute(double flops)
+void Host::execute(double flops) const
 {
   execute(flops, 1.0 /* priority */);
 }
 
-void Host::execute(double flops, double priority)
+void Host::execute(double flops, double priority) const
 {
   this_actor::exec_init(flops)->set_priority(1 / priority)->start()->wait();
 }
@@ -318,7 +319,7 @@ size_t sg_host_count()
 }
 sg_host_t* sg_host_list()
 {
-  simgrid::s4u::Engine* e = simgrid::s4u::Engine::get_instance();
+  const simgrid::s4u::Engine* e = simgrid::s4u::Engine::get_instance();
   size_t host_count       = e->get_host_count();
   xbt_assert(host_count > 0, "There is no host!");
   std::vector<simgrid::s4u::Host*> hosts = e->get_all_hosts();
@@ -349,7 +350,7 @@ sg_host_t sg_host_by_name(const char* name)
   return simgrid::s4u::Host::by_name_or_null(name);
 }
 
-xbt_dynar_t sg_hosts_as_dynar()
+xbt_dynar_t sg_hosts_as_dynar() // XBT_ATTRIB_DEPRECATED_v330
 {
   std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
 
@@ -389,7 +390,7 @@ void sg_host_user_destroy(sg_host_t host) // deprecated
 }
 
 // ========= storage related functions ============
-void sg_host_disks(sg_host_t host, unsigned int* disk_count, sg_disk_t** disks)
+void sg_host_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks)
 {
   std::vector<sg_disk_t> list = host->get_disks();
   *disk_count                 = list.size();