uwu
parent
b6fc170399
commit
6161d9b794
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
include(cmake/color.cmake)
|
include(cmake/color.cmake)
|
||||||
set(BLT_VERSION 5.3.1)
|
set(BLT_VERSION 5.3.2)
|
||||||
|
|
||||||
set(BLT_TARGET BLT)
|
set(BLT_TARGET BLT)
|
||||||
|
|
||||||
|
|
|
@ -37,25 +37,25 @@
|
||||||
namespace blt
|
namespace blt
|
||||||
{
|
{
|
||||||
|
|
||||||
class barrier
|
class barrier_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit barrier(blt::size_t threads, std::optional<std::reference_wrapper<std::atomic_bool>> exit_cond = {}):
|
explicit barrier_t(blt::size_t threads, std::optional<std::reference_wrapper<std::atomic_bool>> exit_cond = {}):
|
||||||
thread_count(threads), threads_waiting(0), use_count(0), exit_cond(exit_cond), count_mutex(), cv()
|
thread_count(threads), threads_waiting(0), use_count(0), exit_cond(exit_cond), count_mutex(), cv()
|
||||||
{
|
{
|
||||||
if (threads == 0)
|
if (threads == 0)
|
||||||
throw std::runtime_error("Barrier thread count cannot be 0");
|
throw std::runtime_error("Barrier thread count cannot be 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
barrier(const barrier& copy) = delete;
|
barrier_t(const barrier_t& copy) = delete;
|
||||||
|
|
||||||
barrier(barrier&& move) = delete;
|
barrier_t(barrier_t&& move) = delete;
|
||||||
|
|
||||||
barrier& operator=(const barrier& copy) = delete;
|
barrier_t& operator=(const barrier_t& copy) = delete;
|
||||||
|
|
||||||
barrier& operator=(barrier&& move) = delete;
|
barrier_t& operator=(barrier_t&& move) = delete;
|
||||||
|
|
||||||
~barrier() = default;
|
~barrier_t() = default;
|
||||||
|
|
||||||
void wait()
|
void wait()
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ namespace blt
|
||||||
|
|
||||||
// improves performance by not blocking the thread for n iterations of the loop.
|
// improves performance by not blocking the thread for n iterations of the loop.
|
||||||
// If the condition is not met by the end of this loop we can block the thread.
|
// If the condition is not met by the end of this loop we can block the thread.
|
||||||
static constexpr blt::size_t BUSY_LOOP_WAIT = 200;
|
static constexpr size_t BUSY_LOOP_WAIT = 200;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 154c63489e84d5569d3b466342a2ae8fd99e4734
|
Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b
|
Loading…
Reference in New Issue