Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simix::Synchro: Factorize the refcounting for child classes
[simgrid.git] / src / simix / Synchro.h
index b55a2b9..dc5a949 100644 (file)
@@ -19,9 +19,17 @@ namespace simix {
     Synchro();
     virtual ~Synchro();
     e_smx_state_t state;               /* State of the synchro */
-    char *name;                        /* synchro name if any */
+    char *name = nullptr;              /* synchro name if any */
     xbt_fifo_t simcalls;               /* List of simcalls waiting for this synchro */
     char *category = nullptr;          /* For instrumentation */
+
+    virtual void suspend()=0;
+    virtual void resume()=0;
+
+    void ref();
+    void unref();
+  private:
+    int refcount=1;
   };
 }} // namespace simgrid::simix
 #else /* not C++ */