Namespaces
Variants

std:: once_flag

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
(C++11)
(C++11)
once_flag
(C++11)
(C++11)
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
헤더 파일에 정의됨 <mutex>
class once_flag ;
(C++11 이후)

클래스 std::once_flag std::call_once 를 위한 헬퍼 구조체입니다.

std::once_flag 타입의 객체를 std::call_once 에 대한 여러 호출에 전달하면, 이러한 호출들이 서로 조정되어 단 하나의 호출만 실제로 완료까지 실행되도록 합니다.

std::once_flag 는 복사 가능하지도 이동 가능하지도 않습니다.

목차

멤버 함수

std::once_flag:: once_flag

constexpr once_flag ( ) noexcept ;

once_flag 객체를 생성합니다. 내부 상태는 아직 어떤 함수도 호출되지 않았음을 나타내도록 설정됩니다.

Parameters

(없음)


참고 항목

(C++11)
여러 스레드에서 호출되더라도 함수를 한 번만 호출
(함수 템플릿)
C documentation for once_flag