Namespaces
Variants

std::latch:: arrive_and_wait

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
void arrive_and_wait ( std:: ptrdiff_t n = 1 ) ;
(C++20부터)

내부 카운터를 원자적으로 n 만큼 감소시키고, (필요한 경우) 카운터가 0에 도달할 때까지 호출 스레드를 블록합니다. 다음 코드와 동등합니다: count_down ( n ) ; wait ( ) ; .

만약 n 이 내부 카운터의 값보다 크거나 음수인 경우, 동작은 정의되지 않습니다.

매개변수

n - 내부 카운터가 감소되는 값

반환값

(없음)

예외

오류 발생 시 뮤텍스 타입에 허용되는 오류 코드와 함께 std::system_error 를 발생시킵니다.