名前空間
変種
操作

標準ライブラリヘッダー <hazard_pointer> (C++26)

From cppreference.com
 
 
標準ライブラリヘッダー
 

このヘッダーはスレッドサポートライブラリの一部です。

目次

クラス

オブジェクトをハザードポインターで保護可能にする
(クラステンプレート) [編集]
任意の時点において最大1つのスレッドによって所有され得る単一書き込み多重読み込みポインター
(クラス) [編集]

関数

ハザードポインターを構築する
(関数) [編集]
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;      // exposition only
  };
}

[編集] クラス 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;
  };
}
English 日本語 中文(简体) 中文(繁體)