FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
marenv::AtomicSharedPtr< T > Class Template Reference

#include <AtomicSharedPtr.h>

Public Member Functions

std::shared_ptr< T > load () const
 The current pointer; null before the first store.
 
void store (std::shared_ptr< T > ptr)
 Publishes ptr; readers that loaded the previous one keep it alive.
 

Detailed Description

template<typename T>
class marenv::AtomicSharedPtr< T >

A shared_ptr published by one thread and read by others, as std::atomic<std::shared_ptr<T>>.

This is std::atomic<std::shared_ptr<T>> where the standard library has it (libstdc++, MSVC). Apple's libc++ does not have it yet; there the shared_ptr overloads of std::atomic_load and std::atomic_store do the same, which C++20 deprecates in favour of the specialisation.


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