Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[surf] Add backlinks from Cpu to surf::Host
[simgrid.git] / src / surf / cpu_interface.cpp
index 17029db..d99dad7 100644 (file)
@@ -231,6 +231,17 @@ void Cpu::setState(e_surf_resource_state_t state)
   surf_callback_emit(cpuStateChangedCallbacks, this, old, state);
 }
 
+void Cpu::plug(simgrid::Host* host)
+{
+  if (this->m_host != nullptr)
+    xbt_die("Aleady plugged into host %s", host->id().c_str());
+  host->set_facet(this);
+  this->m_host = host;
+  simgrid::surf::cpuCreatedCallbacks(this);
+  simgrid::surf::cpuStateChangedCallbacks(this,
+    SURF_RESOURCE_ON, this->getState());
+}
+
 /**********
  * Action *
  **********/