Standard library header <hazard_pointer> (C++26)
From cppreference.net
C++
Standard library headers
이 헤더는 스레드 지원 라이브러리의 일부입니다.
클래스 |
||
|
(C++26)
|
객체가 위험 포인터로 보호될 수 있도록 허용
(클래스 템플릿) |
|
|
(C++26)
|
어느 시점에서든 최대 하나의 스레드만 소유할 수 있는 단일 작성자 다중 판독기 포인터
(클래스) |
|
함수 |
||
|
(C++26)
|
위험 포인터를 생성
(함수) |
|
|
(C++26)
|
std::swap
알고리즘을 특수화
(함수 템플릿) |
|
시놉시스
namespace std { // hazard_pointer_obj_base template<class T, class D = default_delete<T>> class hazard_pointer_obj_base; // hazard_pointer class hazard_pointer; // make_hazard_pointer hazard_pointer make_hazard_pointer(); void swap(hazard_pointer&, hazard_pointer&) noexcept; }
클래스 템플릿 std::hazard_pointer_obj_base
namespace std { template<class T, class D = default_delete<T>> class hazard_pointer_obj_base { public: void retire(D d = D()) noexcept; protected: hazard_pointer_obj_base() = default; hazard_pointer_obj_base(const hazard_pointer_obj_base&) = default; hazard_pointer_obj_base(hazard_pointer_obj_base&&) = default; hazard_pointer_obj_base& operator=(const hazard_pointer_obj_base&) = default; hazard_pointer_obj_base& operator=(hazard_pointer_obj_base&&) = default; ~hazard_pointer_obj_base() = default; private: D deleter; // 설명용으로만 사용 }; }
클래스 std::hazard_pointer
namespace std { class hazard_pointer { public: hazard_pointer() noexcept; hazard_pointer(hazard_pointer&&) noexcept; hazard_pointer& operator=(hazard_pointer&&) noexcept; ~hazard_pointer(); bool empty() const noexcept; template<class T> T* protect(const atomic<T*>& src) noexcept; template<class T> bool try_protect(T*& ptr, const atomic<T*>& src) noexcept; template<class T> void reset_protection(const T* ptr) noexcept; void reset_protection(nullptr_t = nullptr) noexcept; void swap(hazard_pointer&) noexcept; }; }