Public Member Functions | Private Types | Private Attributes | List of all members
atomic_unique_ptr< T > Class Template Reference

This is an atomic variant of std::unique_ptr. An instance of atomic_unique_ptr can be shared among threads by the use of swap(shared_target).
Namely, it is destructive reading. Use atomic_shared_ptr when the pointer is required to be shared among scopes and threads.
This implementation relies on an atomic-swap machine code, e.g. lock xchg, or std::atomic. More...

#include <atomic_smart_ptr.h>

Inheritance diagram for atomic_unique_ptr< T >:
Inheritance graph
[legend]

Public Member Functions

 atomic_unique_ptr (t_ptr t) noexcept
 
void reset (t_ptr t=nullptr) noexcept
 
void swap (atomic_unique_ptr &x) noexcept
 
bool operator! () const noexcept
 
 operator bool () const noexcept
 
T & operator* () const noexcept
 This function lacks thread-safety.
 
t_ptr operator-> () const noexcept
 This function lacks thread-safety.
 
t_ptr get () const noexcept
 This function lacks thread-safety.
 
 atomic_unique_ptr (const atomic_unique_ptr &)=delete
 
atomic_unique_ptroperator= (const atomic_unique_ptr &)=delete
 

Private Types

typedef T * t_ptr
 

Private Attributes

atomic< t_ptr > m_ptr
 

Detailed Description

template<typename T>
class atomic_unique_ptr< T >

This is an atomic variant of std::unique_ptr. An instance of atomic_unique_ptr can be shared among threads by the use of swap(shared_target).
Namely, it is destructive reading. Use atomic_shared_ptr when the pointer is required to be shared among scopes and threads.
This implementation relies on an atomic-swap machine code, e.g. lock xchg, or std::atomic.

See Also
atomic_shared_ptr, atomic_unique_ptr_test.cpp

Definition at line 27 of file atomic_smart_ptr.h.

Member Function Documentation

template<typename T>
void atomic_unique_ptr< T >::swap ( atomic_unique_ptr< T > &  x)
inlinenoexcept
Parameters
[in,out]xx is atomically swapped. Nevertheless, this object is not atomically replaced. That is, the object pointed by "this" must not be shared among threads.

Definition at line 43 of file atomic_smart_ptr.h.


The documentation for this class was generated from the following file:

Generated for KAME4 by  doxygen 1.8.3