Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] Refcounting with SIMIX_{process,mutex}_{ref,unref}()
[simgrid.git] / src / simix / smx_process.cpp
index b47211a..bcd0600 100644 (file)
@@ -28,6 +28,21 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix, "Logging specific to SIMIX
 
 unsigned long simix_process_maxpid = 0;
 
+/** Increase the refcount for this process */
+smx_process_t SIMIX_process_ref(smx_process_t process)
+{
+  if (process != nullptr)
+    intrusive_ptr_add_ref(process);
+  return process;
+}
+
+/** Decrease the refcount for this process */
+void SIMIX_process_unref(smx_process_t process)
+{
+  if (process != nullptr)
+    intrusive_ptr_release(process);
+}
+
 /**
  * \brief Returns the current agent.
  *