|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
#include <atomic_shared_ptr.h>

Public Member Functions | |
| atomic_shared_ptr () noexcept=default | |
| Default constructor - initializes with nullptr. | |
| atomic_shared_ptr (std::shared_ptr< T > ptr) noexcept | |
| Construct with initial shared_ptr. | |
| atomic_shared_ptr (const atomic_shared_ptr &other) | |
| Copy constructor - atomically copies the shared_ptr. | |
| atomic_shared_ptr & | operator= (const atomic_shared_ptr &other) |
| Copy assignment - atomically copies the shared_ptr. | |
| atomic_shared_ptr (atomic_shared_ptr &&other) noexcept | |
| Move constructor. | |
| atomic_shared_ptr & | operator= (atomic_shared_ptr &&other) noexcept |
| Move assignment. | |
| atomic_shared_ptr & | operator= (std::shared_ptr< T > ptr) noexcept |
| Assign from shared_ptr. | |
| void | store (std::shared_ptr< T > ptr, std::memory_order order=std::memory_order_seq_cst) noexcept |
| Atomically store a new value. | |
| std::shared_ptr< T > | load (std::memory_order order=std::memory_order_seq_cst) const noexcept |
| Atomically load the current value. | |
| std::shared_ptr< T > | exchange (std::shared_ptr< T > ptr, std::memory_order order=std::memory_order_seq_cst) noexcept |
| Atomically exchange the value. | |
| bool | compare_exchange_weak (std::shared_ptr< T > &expected, std::shared_ptr< T > desired, std::memory_order success=std::memory_order_seq_cst, std::memory_order failure=std::memory_order_seq_cst) noexcept |
| Atomically compare and exchange (weak) | |
| bool | compare_exchange_strong (std::shared_ptr< T > &expected, std::shared_ptr< T > desired, std::memory_order success=std::memory_order_seq_cst, std::memory_order failure=std::memory_order_seq_cst) noexcept |
| Atomically compare and exchange (strong) | |
| operator std::shared_ptr< T > () const noexcept | |
| Conversion operator to shared_ptr. | |
| T & | operator* () const noexcept |
| Dereference operator. | |
| T * | operator-> () const noexcept |
| Member access operator. | |
| operator bool () const noexcept | |
| Boolean conversion - check if not null. | |
| T * | get_unsafe () const noexcept |
| Get raw pointer (unsafe - for debugging only) | |
| void | reset () noexcept |
| Reset to nullptr. | |
| void | reset (T *ptr) noexcept |
| Reset to new value. | |
Private Attributes | |
| std::shared_ptr< T > | ptr_ {nullptr} |
Definition at line 50 of file atomic_shared_ptr.h.
|
defaultnoexcept |
Default constructor - initializes with nullptr.
|
inlineexplicitnoexcept |
Construct with initial shared_ptr.
| ptr | Initial value |
Definition at line 61 of file atomic_shared_ptr.h.
|
inline |
Copy constructor - atomically copies the shared_ptr.
| other | Source atomic_shared_ptr |
Definition at line 68 of file atomic_shared_ptr.h.
|
inlinenoexcept |
Move constructor.
| other | Source atomic_shared_ptr |
Definition at line 87 of file atomic_shared_ptr.h.
|
inlinenoexcept |
Atomically compare and exchange (strong)
| expected | Expected value (updated on failure) |
| desired | New value if comparison succeeds |
| success | Memory ordering on success |
| failure | Memory ordering on failure |
Only fails if comparison actually fails (no spurious failures).
Definition at line 195 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::ptr_, and kcenon::thread::success.
|
inlinenoexcept |
Atomically compare and exchange (weak)
| expected | Expected value (updated on failure) |
| desired | New value if comparison succeeds |
| success | Memory ordering on success |
| failure | Memory ordering on failure |
May spuriously fail even if comparison would succeed. Use in loops for lock-free algorithms.
Definition at line 172 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::ptr_, and kcenon::thread::success.
|
inlinenodiscardnoexcept |
Atomically exchange the value.
| ptr | New value |
| order | Memory ordering |
Definition at line 151 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::ptr_.
|
inlinenodiscardnoexcept |
Get raw pointer (unsafe - for debugging only)
Definition at line 247 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::load().

|
inlinenodiscardnoexcept |
Atomically load the current value.
| order | Memory ordering |
The returned shared_ptr keeps the object alive as long as it exists - no manual hazard pointer management needed.
Definition at line 136 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::ptr_.
Referenced by kcenon::thread::atomic_shared_ptr< T >::get_unsafe(), kcenon::thread::atomic_shared_ptr< T >::operator bool(), kcenon::thread::atomic_shared_ptr< T >::operator std::shared_ptr< T >(), kcenon::thread::atomic_shared_ptr< T >::operator*(), kcenon::thread::atomic_shared_ptr< T >::operator->(), and kcenon::thread::atomic_shared_ptr< T >::operator=().

|
inlineexplicitnodiscardnoexcept |
Boolean conversion - check if not null.
Definition at line 237 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::load().

|
inlinenodiscardnoexcept |
Conversion operator to shared_ptr.
Definition at line 212 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::load().

|
inlinenodiscardnoexcept |
Dereference operator.
Definition at line 221 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::load().

|
inlinenodiscardnoexcept |
Member access operator.
Definition at line 230 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::load().

|
inlinenoexcept |
Move assignment.
| other | Source atomic_shared_ptr |
Definition at line 95 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::store().

|
inline |
Copy assignment - atomically copies the shared_ptr.
| other | Source atomic_shared_ptr |
Definition at line 76 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::load(), and kcenon::thread::atomic_shared_ptr< T >::store().

|
inlinenoexcept |
Assign from shared_ptr.
| ptr | New value |
Definition at line 107 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::store().

|
inlinenoexcept |
Reset to nullptr.
Definition at line 254 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::store().

|
inlinenoexcept |
Reset to new value.
| ptr | New managed object |
Definition at line 262 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::store().

|
inlinenoexcept |
Atomically store a new value.
| ptr | New value |
| order | Memory ordering |
Uses memory_order_seq_cst by default for maximum safety.
Definition at line 119 of file atomic_shared_ptr.h.
References kcenon::thread::atomic_shared_ptr< T >::ptr_.
Referenced by kcenon::thread::atomic_shared_ptr< T >::operator=(), kcenon::thread::atomic_shared_ptr< T >::operator=(), kcenon::thread::atomic_shared_ptr< T >::operator=(), kcenon::thread::atomic_shared_ptr< T >::reset(), and kcenon::thread::atomic_shared_ptr< T >::reset().

|
private |
Definition at line 270 of file atomic_shared_ptr.h.
Referenced by kcenon::thread::atomic_shared_ptr< T >::compare_exchange_strong(), kcenon::thread::atomic_shared_ptr< T >::compare_exchange_weak(), kcenon::thread::atomic_shared_ptr< T >::exchange(), kcenon::thread::atomic_shared_ptr< T >::load(), and kcenon::thread::atomic_shared_ptr< T >::store().