Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Enforce "Rule-of-Three/Five".
[simgrid.git] / src / msg / msg_private.hpp
index 3ad7c43..0b832de 100644 (file)
@@ -7,11 +7,9 @@
 #define MSG_PRIVATE_HPP
 
 #include "simgrid/msg.h"
-
 #include "src/kernel/activity/CommImpl.hpp"
 #include "src/kernel/activity/ExecImpl.hpp"
-
-static long long int msg_task_max_counter = 0;
+#include <simgrid/modelchecker.h>
 
 /**************** datatypes **********************************/
 namespace simgrid {
@@ -20,15 +18,20 @@ class Task {
   std::string name_             = "";
   std::string tracing_category_ = "";
   void* userdata_               = nullptr;
-  long long int counter_;
+  long long int id_;
 
 public:
-  ~Task();
   explicit Task(std::string name, double flops_amount, double bytes_amount, void* data)
       : name_(std::move(name)), userdata_(data), flops_amount(flops_amount), bytes_amount(bytes_amount)
   {
-    counter_ = msg_task_max_counter++;
+    static std::atomic_ullong counter{0};
+    id_ = counter++;
+    if (MC_is_active())
+      MC_ignore_heap(&(id_), sizeof(id_));
   }
+  Task(const Task&) = delete;
+  Task& operator=(const Task&) = delete;
+  ~Task();
   void set_used();
   void set_not_used() { this->is_used = false; }
 
@@ -40,7 +43,7 @@ public:
   bool has_tracing_category() { return not tracing_category_.empty(); }
   void* get_user_data() { return userdata_; }
   void set_user_data(void* data) { userdata_ = data; }
-  long long int get_counter() { return counter_; }
+  long long int get_id() { return id_; }
 
   kernel::activity::ExecImplPtr compute          = nullptr; /* SIMIX modeling of computation */
   s4u::CommPtr comm                              = nullptr; /* S4U modeling of communication */