]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/resource/StandardLinkImpl.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Coding style: prefer keyword "not" to "!".
[simgrid.git] / src / kernel / resource / StandardLinkImpl.cpp
index ee06be462e242822df7b0c4cf6ce831e59bf936f..6648c23d4528b096377140bd1cc1de788f3b6bd6 100644 (file)
@@ -15,19 +15,21 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
  * Model *
  *********/
 
-namespace simgrid {
-namespace kernel {
-namespace resource {
+namespace simgrid::kernel::resource {
 
 StandardLinkImpl::StandardLinkImpl(const std::string& name) : LinkImpl(name), piface_(this)
 {
   if (name != "__loopback__")
     xbt_assert(not s4u::Link::by_name_or_null(name), "Link '%s' declared several times in the platform.", name.c_str());
 
-  s4u::Engine::get_instance()->link_register(name, &piface_);
   XBT_DEBUG("Create link '%s'", name.c_str());
 }
 
+void StandardLinkImpl::Deleter::operator()(resource::StandardLinkImpl* link) const
+{
+  link->destroy();
+}
+
 /** @brief Fire the required callbacks and destroy the object
  *
  * Don't delete directly a Link, call l->destroy() instead.
@@ -35,7 +37,6 @@ StandardLinkImpl::StandardLinkImpl(const std::string& name) : LinkImpl(name), pi
 void StandardLinkImpl::destroy()
 {
   s4u::Link::on_destruction(piface_);
-  s4u::Engine::get_instance()->link_unregister(get_name());
   delete this;
 }
 
@@ -138,6 +139,4 @@ void StandardLinkImpl::set_concurrency_limit(int limit) const
   get_constraint()->set_concurrency_limit(limit);
 }
 
-} // namespace resource
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::resource