mirror of
https://github.com/boostorg/fiber.git
synced 2026-02-20 14:42:21 +00:00
C++14 - barrier
This commit is contained in:
@@ -18,8 +18,8 @@ namespace boost {
|
||||
namespace fibers {
|
||||
|
||||
barrier::barrier( std::size_t initial) :
|
||||
initial_( initial),
|
||||
current_( initial_) {
|
||||
initial_{ initial },
|
||||
current_{ initial_ } {
|
||||
if ( 0 == initial) {
|
||||
throw invalid_argument( static_cast< int >( std::errc::invalid_argument),
|
||||
"boost fiber: zero initial barrier count");
|
||||
@@ -29,7 +29,7 @@ barrier::barrier( std::size_t initial) :
|
||||
bool
|
||||
barrier::wait() {
|
||||
std::unique_lock< mutex > lk( mtx_);
|
||||
const bool cycle( cycle_);
|
||||
const bool cycle = cycle_;
|
||||
if ( 0 == --current_) {
|
||||
cycle_ = ! cycle_;
|
||||
current_ = initial_;
|
||||
|
||||
Reference in New Issue
Block a user