Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use default destructor.
[simgrid.git] / src / include / xbt / parmap.hpp
index f0fbb1d..5818def 100644 (file)
@@ -38,6 +38,7 @@ namespace xbt {
 template <typename T> class Parmap {
 public:
   Parmap(unsigned num_workers, e_xbt_parmap_mode_t mode);
+  Parmap(const Parmap&) = delete;
   ~Parmap();
   void apply(void (*fun)(T), const std::vector<T>& data);
   boost::optional<T> next();
@@ -61,7 +62,7 @@ private:
   class Synchro {
   public:
     explicit Synchro(Parmap<T>& parmap) : parmap(parmap) {}
-    virtual ~Synchro() {}
+    virtual ~Synchro() = default;
     /**
      * \brief Wakes all workers and waits for them to finish the tasks.
      *
@@ -137,15 +138,16 @@ private:
   Synchro* new_synchro(e_xbt_parmap_mode_t mode);
   void work();
 
-  Flag status;                 /**< is the parmap active or being destroyed? */
-  unsigned work_round;         /**< index of the current round */
-  unsigned thread_counter;     /**< number of workers that have done the work */
-  unsigned num_workers;        /**< total number of worker threads including the controller */
-  xbt_os_thread_t* workers;    /**< worker thread handlers */
-  void (*fun)(const T);        /**< function to run in parallel on each element of data */
-  const std::vector<T>* data;  /**< parameters to pass to fun in parallel */
-  std::atomic<unsigned> index; /**< index of the next element of data to pick */
-  Synchro* synchro;            /**< synchronization object */
+  Flag status;              /**< is the parmap active or being destroyed? */
+  unsigned work_round;      /**< index of the current round */
+  xbt_os_thread_t* workers; /**< worker thread handlers */
+  unsigned num_workers;     /**< total number of worker threads including the controller */
+  Synchro* synchro;         /**< synchronization object */
+
+  unsigned thread_counter    = 0;       /**< number of workers that have done the work */
+  void (*fun)(const T)       = nullptr; /**< function to run in parallel on each element of data */
+  const std::vector<T>* data = nullptr; /**< parameters to pass to fun in parallel */
+  std::atomic<unsigned> index;          /**< index of the next element of data to pick */
 };
 
 /**