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>
|
| 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_ptr & | operator= (const atomic_unique_ptr &)=delete |
|
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.
- Parameters
-
[in,out] | x | x 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: