#include "timemory/ert/barrier.hpp"
Definition at line 50 of file barrier.hpp.
◆ atomic_t
◆ condvar_t
◆ lock_t
◆ mutex_t
◆ size_type
◆ thread_barrier() [1/3]
tim::ert::thread_barrier::thread_barrier |
( |
size_t |
nthreads | ) |
|
|
inlineexplicit |
Definition at line 60 of file barrier.hpp.
61 : m_master(std::this_thread::get_id())
62 , m_num_threads(nthreads)
64 , m_future(m_promise.get_future().share())
◆ thread_barrier() [2/3]
◆ thread_barrier() [3/3]
◆ cv_wait()
void tim::ert::thread_barrier::cv_wait |
( |
| ) |
|
|
inline |
Definition at line 109 of file barrier.hpp.
113#if defined(TIMEMORY_INTERNAL_TESTING)
123 m_cv.wait(lk, [&] {
return m_counter >= m_num_threads; });
std::unique_lock< mutex_t > lock_t
#define TIMEMORY_EXCEPTION(...)
References is_master(), and TIMEMORY_EXCEPTION.
◆ is_master()
bool tim::ert::thread_barrier::is_master |
( |
| ) |
const |
|
inline |
◆ notify_wait()
void tim::ert::thread_barrier::notify_wait |
( |
| ) |
|
|
inline |
Definition at line 132 of file barrier.hpp.
137 while(m_notify.load() < m_num_threads)
139 m_promise.set_value();
140 while(m_notify.load() > 0)
143 std::promise<void> _ptmp;
144 std::shared_future<void> _ftmp = _ptmp.get_future().share();
145 std::swap(m_promise, _ptmp);
146 std::swap(m_future, _ftmp);
References is_master().
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ size()
size_type tim::ert::thread_barrier::size |
( |
| ) |
const |
|
inline |
Definition at line 73 of file barrier.hpp.
73{
return m_num_threads; }
◆ spin_wait()
void tim::ert::thread_barrier::spin_wait |
( |
| ) |
|
|
inline |
Definition at line 76 of file barrier.hpp.
80#if defined(TIMEMORY_INTERNAL_TESTING)
93 while(m_counter < m_num_threads)
95 while(spin_lock.test_and_set(std::memory_order_acquire))
97 spin_lock.clear(std::memory_order_release);
References is_master(), and TIMEMORY_EXCEPTION.
The documentation for this class was generated from the following file: