XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap);
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
/** @addtogroup XBT_parmap
* @ingroup XBT_misc
*/
template <typename T> void Parmap<T>::work()
{
- unsigned length = common_data->size();
+ unsigned length = static_cast<unsigned>(common_data->size());
unsigned index = common_index.fetch_add(1, std::memory_order_relaxed);
while (index < length) {
worker_fun((*common_data)[index]);
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 */
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 */
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; });
}
}
/** @} */
-}
-}
+} // namespace simgrid::xbt
#endif