Namespaces
Variants

std::barrier<CompletionFunction>:: barrier

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
constexpr explicit barrier ( std:: ptrdiff_t expected,
CompletionFunction f = CompletionFunction ( ) ) ;
(1) (C++20 이후)
barrier ( const barrier & ) = delete ;
(2) (C++20 이후)
1) 각 단계의 초기 예상 개수와 첫 번째 단계의 현재 예상 개수를 모두 expected 로 설정하고, 완료 함수 객체를 std :: move ( f ) 로 초기화한 후 첫 번째 단계를 시작합니다. expected 가 음수이거나 max() 보다 큰 경우 동작은 정의되지 않습니다.
2) 복사 생성자가 삭제되었습니다. barrier 는 복사 가능하거나 이동 가능하지 않습니다.

매개변수

expected - 예상 카운트의 초기값
f - 단계 완료 시 호출될 완료 함수 객체

예외

1) CompletionFunction 의 이동 생성자에 의해 발생하는 모든 예외.

참고 사항

expected 는 0으로 설정하는 것이 허용됩니다. 그러나 이러한 barrier 에 대해 소멸자 이외의 비정적 멤버 함수를 호출하는 것은 정의되지 않은 동작을 초래합니다. 다시 말해, 이러한 barrier 는 오직 소멸만 가능합니다.