Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Replace redundant type with "auto" (include/ and src/).
[simgrid.git] / src / include / xbt / parmap.hpp
index 51f4818..ac909e7 100644 (file)
@@ -1,6 +1,6 @@
 /* A thread pool (C++ version).                                             */
 
-/* Copyright (c) 2004-2019 The SimGrid Team. All rights reserved.           */
+/* Copyright (c) 2004-2020 The SimGrid Team. All rights reserved.           */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -96,8 +96,7 @@ private:
 
   class PosixSynchro : public Synchro {
   public:
-    explicit PosixSynchro(Parmap<T>& parmap);
-    ~PosixSynchro();
+    explicit PosixSynchro(Parmap<T>& parmap) : Synchro(parmap) {}
     void master_signal() override;
     void master_wait() override;
     void worker_signal() override;
@@ -168,7 +167,7 @@ template <typename T> Parmap<T>::Parmap(unsigned num_workers, e_xbt_parmap_mode_
   this->workers[0] = nullptr;
 
   for (unsigned i = 1; i < num_workers; i++) {
-    ThreadData* data = new ThreadData(*this, i);
+    auto* data       = new ThreadData(*this, i);
     this->workers[i] = new std::thread(worker_main, data);
 
     /* Bind the worker to a core if possible */
@@ -295,7 +294,7 @@ template <typename T> void Parmap<T>::worker_main(ThreadData* data)
   XBT_CDEBUG(xbt_parmap, "New worker thread created");
 
   /* Worker's main loop */
-  while (1) {
+  while (true) {
     round++; // New scheduling round
     parmap.synchro->worker_wait(round);
     if (parmap.destroying)
@@ -311,14 +310,6 @@ template <typename T> void Parmap<T>::worker_main(ThreadData* data)
   delete data;
 }
 
-template <typename T> Parmap<T>::PosixSynchro::PosixSynchro(Parmap<T>& parmap) : Synchro(parmap)
-{
-}
-
-template <typename T> Parmap<T>::PosixSynchro::~PosixSynchro()
-{
-}
-
 template <typename T> void Parmap<T>::PosixSynchro::master_signal()
 {
   std::unique_lock<std::mutex> lk(ready_mutex);