Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[s4u] Add member initializers
[simgrid.git] / src / simix / Synchro.h
index 9ed8f9f..da0e8e0 100644 (file)
@@ -5,6 +5,10 @@
 
 #ifndef _SIMIX_SYNCHRO_HPP
 #define _SIMIX_SYNCHRO_HPP
+
+#include <string>
+
+#include <xbt/base.h>
 #include "simgrid/forward.h"
 
 #ifdef __cplusplus
 namespace simgrid {
 namespace simix {
 
-  class Synchro {
+  XBT_PUBLIC_CLASS Synchro {
   public:
     Synchro();
     virtual ~Synchro();
-    e_smx_state_t state;               /* State of the synchro */
-    char *name;                        /* synchro name if any */
-    xbt_fifo_t simcalls;               /* List of simcalls waiting for this synchro */
+    e_smx_state_t state = SIMIX_WAITING; /* State of the synchro */
+    std::string name;                  /* synchro name if any */
+    xbt_fifo_t simcalls = nullptr;     /* List of simcalls waiting for this synchro */
     char *category = nullptr;          /* For instrumentation */
 
     virtual void suspend()=0;
     virtual void resume()=0;
+    virtual void post() =0; // What to do when a simcall terminates
+
+    void ref();
+    void unref();
+  private:
+    int refcount = 1;
   };
 }} // namespace simgrid::simix
 #else /* not C++ */