7#ifdef ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLED
11# include <oneapi/tbb/task.h>
21 template<
typename TIdx>
22 class BarrierThread final
25 explicit BarrierThread(TIdx
const& threadCount) : m_threadCount(threadCount)
28 m_suspended.reserve(
static_cast<std::size_t
>(threadCount));
34 oneapi::tbb::task::suspend(
35 [
this](oneapi::tbb::task::suspend_point sp)
39 std::vector<oneapi::tbb::task::suspend_point> arrived;
41 std::lock_guard<std::mutex> lock{m_mutex};
42 m_suspended.push_back(sp);
43 if(m_suspended.size() ==
static_cast<std::size_t
>(m_threadCount))
45 arrived.reserve(m_suspended.capacity());
46 arrived.swap(m_suspended);
51 for(
auto point : arrived)
53 oneapi::tbb::task::resume(point);
59 TIdx
const m_threadCount;
61 std::vector<oneapi::tbb::task::suspend_point> m_suspended;
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC constexpr auto assertValueUnsigned(TArg const &arg) -> void
This method checks integral values if they are greater or equal zero. The implementation prevents war...
ALPAKA_FN_HOST auto wait(TAwaited const &awaited) -> void
Waits the thread for the completion of the given awaited action to complete.