Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make msg task extendable too
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Sun, 3 Nov 2019 17:54:21 +0000 (18:54 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Sun, 3 Nov 2019 17:54:21 +0000 (18:54 +0100)
src/msg/msg_private.hpp
src/msg/msg_task.cpp

index 8b0378e..505c892 100644 (file)
 #include "simgrid/msg.h"
 #include "src/kernel/activity/CommImpl.hpp"
 #include <simgrid/modelchecker.h>
 #include "simgrid/msg.h"
 #include "src/kernel/activity/CommImpl.hpp"
 #include <simgrid/modelchecker.h>
+#include <xbt/Extendable.hpp>
 
 #include <cmath>
 
 /**************** datatypes **********************************/
 namespace simgrid {
 namespace msg {
 
 #include <cmath>
 
 /**************** datatypes **********************************/
 namespace simgrid {
 namespace msg {
-class Task {
+class Task : public xbt::Extendable<Task> {
   std::string name_             = "";
   std::string tracing_category_ = "";
   std::string name_             = "";
   std::string tracing_category_ = "";
-  void* userdata_               = nullptr;
   long long int id_;
 
   double timeout_  = 0.0;
   long long int id_;
 
   double timeout_  = 0.0;
@@ -59,8 +59,8 @@ public:
   void set_tracing_category(const char* category) { tracing_category_ = category ? std::string(category) : ""; }
   const std::string& get_tracing_category() { return tracing_category_; }
   bool has_tracing_category() { return not tracing_category_.empty(); }
   void set_tracing_category(const char* category) { tracing_category_ = category ? std::string(category) : ""; }
   const std::string& get_tracing_category() { return tracing_category_; }
   bool has_tracing_category() { return not tracing_category_.empty(); }
-  void* get_user_data() { return userdata_; }
-  void set_user_data(void* data) { userdata_ = data; }
+  XBT_ATTRIB_DEPRECATED_v329("Please use set_data()") void* get_user_data() { return get_data(); }
+  XBT_ATTRIB_DEPRECATED_v329("Please use get_data()") void set_user_data(void* data) { set_data(data); }
   long long int get_id() { return id_; }
   double get_priority() { return priority_; }
   void set_priority(double priority);
   long long int get_id() { return id_; }
   double get_priority() { return priority_; }
   void set_priority(double priority);
index 9a62572..f87e1d8 100644 (file)
@@ -19,10 +19,11 @@ namespace simgrid {
 namespace msg {
 
 Task::Task(const std::string& name, double flops_amount, double bytes_amount, void* data)
 namespace msg {
 
 Task::Task(const std::string& name, double flops_amount, double bytes_amount, void* data)
-    : name_(name), userdata_(data), flops_amount(flops_amount), bytes_amount(bytes_amount)
+    : name_(name), flops_amount(flops_amount), bytes_amount(bytes_amount)
 {
   static std::atomic_ullong counter{0};
   id_ = counter++;
 {
   static std::atomic_ullong counter{0};
   id_ = counter++;
+  set_data(data);
   if (MC_is_active())
     MC_ignore_heap(&(id_), sizeof(id_));
 }
   if (MC_is_active())
     MC_ignore_heap(&(id_), sizeof(id_));
 }
@@ -243,13 +244,13 @@ msg_task_t MSG_parallel_task_create(const char *name, int host_nb, const msg_hos
 /** @brief Return the user data of the given task */
 void* MSG_task_get_data(msg_task_t task)
 {
 /** @brief Return the user data of the given task */
 void* MSG_task_get_data(msg_task_t task)
 {
-  return task->get_user_data();
+  return task->get_data();
 }
 
 /** @brief Sets the user data of a given task */
 void MSG_task_set_data(msg_task_t task, void *data)
 {
 }
 
 /** @brief Sets the user data of a given task */
 void MSG_task_set_data(msg_task_t task, void *data)
 {
-  task->set_user_data(data);
+  task->set_data(data);
 }
 
 /** @brief Returns the sender of the given task */
 }
 
 /** @brief Returns the sender of the given task */