24#include <fmt/format.h>
44 if (num_waiting_threads < 2U) {
46 "Invalid number of threads to wait in PthreadSyncBarrier.");
48 const int error_code = pthread_barrier_init(
49 &barrier_,
nullptr,
static_cast<unsigned int>(num_waiting_threads));
50 if (error_code != 0) {
52 "Failed to initialize PthreadSyncBarrier (error code: {}).",
60 void wait()
override { pthread_barrier_wait(&barrier_); }
72 pthread_barrier_t barrier_{};
Class of exceptions in this library.
Class of barriers to synchronize threads using pthread library.
void wait() override
Wait for other threads.
PthreadSyncBarrier(std::size_t num_waiting_threads)
Constructor.
~PthreadSyncBarrier() override
Destructor.
Namespace of utility functions and classes.
Namespace of stat_bench source codes.
Definition of StatBenchException class.
Definition of SyncBarrier class.