Namespaces
Variants

std::counting_semaphore<LeastMaxValue>:: try_acquire_until

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
template < class Clock, class Duration >
bool try_acquire_until ( const std:: chrono :: time_point < Clock, Duration > & abs_time ) ;
(C++20 이후)

내부 카운터가 1 이상일 경우 원자적으로 감소시키려 시도합니다; 그렇지 않을 경우 내부 카운터가 0 보다 커지고 성공적으로 감소시킬 수 있을 때까지, 또는 abs_time 시간 점이 경과할 때까지 블록합니다.

프로그램은 std:: chrono :: is_clock_v < Clock > false 인 경우 형식이 잘못되었습니다.

목차

사전 조건

Clock Clock 요구 사항을 충족합니다.

매개변수

abs_time - 함수가 실패하기 위해 반드시 대기해야 하는 가장 빠른 시간

반환값

true 만약 내부 카운터를 감소시켰다면, 그렇지 않으면 false 를 반환합니다.

예외

std::system_error 또는 타임아웃 관련 예외를 발생시킬 수 있습니다.

참고 사항

실제로 함수가 실패하는 데 abs_time 이상의 시간이 소요될 수 있습니다.

참고 항목

내부 카운터를 증가시키고 획득자들의 차단을 해제합니다
(public member function)
내부 카운터를 감소시키거나 감소할 수 있을 때까지 차단합니다
(public member function)
차단 없이 내부 카운터를 감소시키려 시도합니다
(public member function)
내부 카운터를 감소시키려 시도하며, 최대 지정된 시간 동안 차단합니다
(public member function)