Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] Add refcount to Process
[simgrid.git] / src / simix / smx_process.cpp
index 1eb504d..836d2d0 100644 (file)
@@ -126,17 +126,21 @@ void SIMIX_process_empty_trash(void)
 
   while ((process = (smx_process_t) xbt_swag_extract(simix_global->process_to_destroy))) {
     XBT_DEBUG("Getting rid of %p",process);
-    delete process->context;
-    xbt_dict_free(&process->properties);
-    xbt_fifo_free(process->comms);
-    xbt_dynar_free(&process->on_exit);
-    delete process;
+    intrusive_ptr_release(process);
   }
 }
 
 namespace simgrid {
 namespace simix {
 
+Process::~Process()
+{
+  delete this->context;
+  xbt_dict_free(&this->properties);
+  xbt_fifo_free(this->comms);
+  xbt_dynar_free(&this->on_exit);
+}
+
 void create_maestro(std::function<void()> code)
 {
   smx_process_t maestro = nullptr;