Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Comment unused function parameters.
[simgrid.git] / src / include / xbt / parmap.hpp
index 35a7e06..1bde553 100644 (file)
@@ -1,7 +1,6 @@
 /* A thread pool (C++ version).                                             */
 
-/* Copyright (c) 2004-2017 The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2004-2018 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. */
 
 #include "src/internal_config.h" // HAVE_FUTEX_H
 #include "src/kernel/context/Context.hpp"
-#include <atomic>
+#include "xbt/xbt_os_thread.h"
+
 #include <boost/optional.hpp>
-#include <simgrid/simix.h>
-#include <vector>
-#include <xbt/log.h>
-#include <xbt/parmap.h>
-#include <xbt/xbt_os_thread.h>
 
 #if HAVE_FUTEX_H
-#include <limits>
 #include <linux/futex.h>
 #include <sys/syscall.h>
 #endif
@@ -39,6 +33,7 @@ template <typename T> class Parmap {
 public:
   Parmap(unsigned num_workers, e_xbt_parmap_mode_t mode);
   Parmap(const Parmap&) = delete;
+  Parmap& operator=(const Parmap&) = delete;
   ~Parmap();
   void apply(void (*fun)(T), const std::vector<T>& data);
   boost::optional<T> next();
@@ -338,7 +333,7 @@ template <typename T> void Parmap<T>::PosixSynchro::master_signal()
 template <typename T> void Parmap<T>::PosixSynchro::master_wait()
 {
   xbt_os_mutex_acquire(done_mutex);
-  if (this->parmap.thread_counter < this->parmap.num_workers) {
+  while (this->parmap.thread_counter < this->parmap.num_workers) {
     /* wait for all workers to be ready */
     xbt_os_cond_wait(done_cond, done_mutex);
   }
@@ -360,7 +355,7 @@ template <typename T> void Parmap<T>::PosixSynchro::worker_wait(unsigned round)
 {
   xbt_os_mutex_acquire(ready_mutex);
   /* wait for more work */
-  if (this->parmap.work_round != round) {
+  while (this->parmap.work_round != round) {
     xbt_os_cond_wait(ready_cond, ready_mutex);
   }
   xbt_os_mutex_release(ready_mutex);