Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove the need of pthread_mutex in mmalloc, to allow its use with sthread
[simgrid.git] / src / include / xbt / parmap.hpp
index 48ce17e..f782f59 100644 (file)
@@ -29,8 +29,7 @@
 
 XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap);
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 /** @addtogroup XBT_parmap
  * @ingroup XBT_misc
@@ -310,7 +309,7 @@ template <typename T> void Parmap<T>::worker_main(ThreadData* data)
 
 template <typename T> void Parmap<T>::PosixSynchro::master_signal()
 {
-  std::unique_lock<std::mutex> lk(ready_mutex);
+  std::unique_lock lk(ready_mutex);
   this->parmap.thread_counter = 1;
   this->parmap.work_round++;
   /* wake all workers */
@@ -319,14 +318,14 @@ template <typename T> void Parmap<T>::PosixSynchro::master_signal()
 
 template <typename T> void Parmap<T>::PosixSynchro::master_wait()
 {
-  std::unique_lock<std::mutex> lk(done_mutex);
+  std::unique_lock lk(done_mutex);
   /* wait for all workers to be ready */
   done_cond.wait(lk, [this]() { return this->parmap.thread_counter >= this->parmap.num_workers; });
 }
 
 template <typename T> void Parmap<T>::PosixSynchro::worker_signal()
 {
-  std::unique_lock<std::mutex> lk(done_mutex);
+  std::unique_lock lk(done_mutex);
   this->parmap.thread_counter++;
   if (this->parmap.thread_counter == this->parmap.num_workers) {
     /* all workers have finished, wake the controller */
@@ -336,7 +335,7 @@ template <typename T> void Parmap<T>::PosixSynchro::worker_signal()
 
 template <typename T> void Parmap<T>::PosixSynchro::worker_wait(unsigned expected_round)
 {
-  std::unique_lock<std::mutex> lk(ready_mutex);
+  std::unique_lock lk(ready_mutex);
   /* wait for more work */
   ready_cond.wait(lk, [this, expected_round]() { return this->parmap.work_round == expected_round; });
 }
@@ -419,7 +418,6 @@ template <typename T> void Parmap<T>::BusyWaitSynchro::worker_wait(unsigned roun
 }
 
 /** @} */
-}
-}
+} // namespace simgrid::xbt
 
 #endif