Program Listing for File ParallelTimeoutBarrier.hpp

Return to documentation for file (include/uitsl/parallel/ParallelTimeoutBarrier.hpp)

#pragma once
#ifndef UITSL_PARALLEL_PARALLELTIMEOUTBARRIER_HPP_INCLUDE
#define UITSL_PARALLEL_PARALLELTIMEOUTBARRIER_HPP_INCLUDE

#include <thread>

#include <mpi.h>

#include "../countdown/Timer.hpp"

#include "ThreadIbarrier.hpp"

namespace uitsl {

template<typename Timer_T=uitsl::Timer<>>
class ParallelTimeoutBarrier {

public:

  ParallelTimeoutBarrier(
    const uitsl::ThreadIbarrier& thread_barrier,
    const Timer_T& timer=Timer_T{}
  ) {

    while (!thread_barrier.IsComplete() && !timer.IsComplete());

  }

};

} // namespace uitsl

#endif // #ifndef UITSL_PARALLEL_PARALLELTIMEOUTBARRIER_HPP_INCLUDE