Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "remove a C-like pimple"
[simgrid.git] / src / surf / host_interface.cpp
index bc4e286..a4367e1 100644 (file)
@@ -31,10 +31,7 @@ void host_add_traces(){
 namespace simgrid {
 namespace surf {
 
-simgrid::xbt::Extension<simgrid::Host, Host> Host::EXTENSION_ID =
-               simgrid::Host::extension_create<simgrid::surf::Host>([](void *h) {
-               static_cast<simgrid::surf::Host*>(h)->destroy();
-        });
+simgrid::xbt::Extension<simgrid::Host, Host> Host::EXTENSION_ID;
 
 /*********
  * Model *
@@ -89,6 +86,15 @@ simgrid::surf::signal<void(simgrid::surf::Host*)> Host::onCreation;
 simgrid::surf::signal<void(simgrid::surf::Host*)> Host::onDestruction;
 simgrid::surf::signal<void(simgrid::surf::Host*)> Host::onStateChange;
 
+void Host::classInit()
+{
+  if (!EXTENSION_ID.valid()) {
+    EXTENSION_ID = simgrid::Host::extension_create<simgrid::surf::Host>([](void *h) {
+       static_cast<simgrid::surf::Host*>(h)->destroy();
+    });
+  }
+}
+
 Host::Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props,
                                 xbt_dynar_t storage, Cpu *cpu)
  : Resource(model, name)