|
| atomic_shared_ptr () noexcept |
|
| atomic_shared_ptr (SharedPtr foo) |
|
| atomic_shared_ptr (const atomic_shared_ptr< T > &)=delete |
|
| ~atomic_shared_ptr () |
|
void | operator= (SharedPtr desired) |
|
void | operator= (const atomic_shared_ptr< T > &)=delete |
|
bool | is_lock_free () const noexcept |
|
SharedPtr | load (std::memory_order order=std::memory_order_seq_cst) const noexcept |
|
| operator SharedPtr () const |
|
void | store (SharedPtr n, std::memory_order order=std::memory_order_seq_cst) |
|
SharedPtr | exchange (SharedPtr n, std::memory_order order=std::memory_order_seq_cst) |
|
bool | compare_exchange_weak (SharedPtr &expected, const SharedPtr &n, std::memory_order mo=std::memory_order_seq_cst) noexcept |
|
bool | compare_exchange_weak (SharedPtr &expected, const SharedPtr &n, std::memory_order success, std::memory_order failure) |
|
bool | compare_exchange_weak (SharedPtr &expected, SharedPtr &&desired, std::memory_order mo=std::memory_order_seq_cst) noexcept |
|
bool | compare_exchange_weak (SharedPtr &expected, SharedPtr &&desired, std::memory_order success, std::memory_order failure) |
|
bool | compare_exchange_strong (SharedPtr &expected, const SharedPtr &n, std::memory_order mo=std::memory_order_seq_cst) noexcept |
|
bool | compare_exchange_strong (SharedPtr &expected, const SharedPtr &n, std::memory_order success, std::memory_order failure) |
|
bool | compare_exchange_strong (SharedPtr &expected, SharedPtr &&desired, std::memory_order mo=std::memory_order_seq_cst) noexcept |
|
bool | compare_exchange_strong (SharedPtr &expected, SharedPtr &&desired, std::memory_order success, std::memory_order failure) |
|
template<typename T, template< typename > class Atom = std::atomic, typename CountedDetail = detail::shared_ptr_internals>
class folly::atomic_shared_ptr< T, Atom, CountedDetail >
Definition at line 73 of file AtomicSharedPtr.h.
template<typename T, template< typename > class Atom = std::atomic, typename CountedDetail = detail::shared_ptr_internals>
Definition at line 147 of file AtomicSharedPtr.h.
References folly::PackedSyncPtr< T >::get(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::get_newptr(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::get_shared_ptr(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::owners_eq(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::ptr_, folly::atomic_shared_ptr< T, Atom, CountedDetail >::release_external(), and folly::atomic_shared_ptr< T, Atom, CountedDetail >::takeOwnedBase().
156 if (!
owners_eq(oldptr, CountedDetail::get_counted_base(expected))) {
161 expectedptr = oldptr;
162 if (
ptr_.compare_exchange_weak(expectedptr, newptr, success, failure)) {
PackedPtr takeOwnedBase(std::memory_order order) const noexcept
AtomicStruct< PackedPtr, Atom > ptr_
typename CountedDetail::template CountedPtr< T > SharedPtr
SharedPtr get_shared_ptr(const PackedPtr &p, bool inc=true) const
bool owners_eq(PackedPtr &p1, BasePtr *p2)
folly::PackedSyncPtr< BasePtr > PackedPtr
void release_external(PackedPtr &res, int64_t c=0) const
PackedPtr get_newptr(const SharedPtr &n) const
template<typename T, template< typename > class Atom = std::atomic, typename CountedDetail = detail::shared_ptr_internals>
Definition at line 250 of file AtomicSharedPtr.h.
References folly::atomic_shared_ptr< T, Atom, CountedDetail >::add_external(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::ALIASED_PTR, count, folly::data(), and folly::PackedSyncPtr< T >::init().
Referenced by folly::atomic_shared_ptr< T, Atom, CountedDetail >::compare_exchange_weak(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::exchange(), and folly::atomic_shared_ptr< T, Atom, CountedDetail >::store().
256 newval = CountedDetail::get_counted_base(n);
257 if (n.get() != CountedDetail::template get_shared_ptr<T>(newval)) {
260 auto data = CountedDetail::template make_ptr<SharedPtr>(n);
261 newval = CountedDetail::get_counted_base(
data);
271 newptr.init(newval, count);
void add_external(BasePtr *res, int64_t c=0) const
typename CountedDetail::counted_base BasePtr
constexpr auto data(C &c) -> decltype(c.data())
static constexpr unsigned ALIASED_PTR
folly::PackedSyncPtr< BasePtr > PackedPtr
template<typename T, template< typename > class Atom = std::atomic, typename CountedDetail = detail::shared_ptr_internals>
Definition at line 322 of file AtomicSharedPtr.h.
References folly::atomic_shared_ptr< T, Atom, CountedDetail >::ALIASED_PTR, folly::PackedSyncPtr< T >::extra(), and folly::PackedSyncPtr< T >::get().
Referenced by folly::atomic_shared_ptr< T, Atom, CountedDetail >::compare_exchange_weak(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::exchange(), and folly::atomic_shared_ptr< T, Atom, CountedDetail >::load().
325 auto res = CountedDetail::template get_shared_ptr_from_counted_base<T>(
329 CountedDetail::template get_shared_ptr_from_counted_base<SharedPtr>(
static constexpr unsigned ALIASED_PTR
template<typename T, template< typename > class Atom = std::atomic, typename CountedDetail = detail::shared_ptr_internals>
Definition at line 375 of file AtomicSharedPtr.h.
References folly::AtomicStruct< T, Atom >::compare_exchange_weak(), count, folly::PackedSyncPtr< T >::extra(), folly::PackedSyncPtr< T >::get(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::get_local_count(), folly::AtomicStruct< T, Atom >::load(), and folly::fibers::local().
Referenced by folly::atomic_shared_ptr< T, Atom, CountedDetail >::takeOwnedBase().
379 if (local.get() != p) {
382 auto newlocal =
local;
384 newlocal.setExtra(local.extra() -
count);
392 if (
ptr_.compare_exchange_weak(local, newlocal, mo)) {
397 CountedDetail::template release_shared<T>(p,
count);
unsigned int get_local_count(const PackedPtr &p) const
AtomicStruct< PackedPtr, Atom > ptr_
folly::PackedSyncPtr< BasePtr > PackedPtr
template<typename T, template< typename > class Atom = std::atomic, typename CountedDetail = detail::shared_ptr_internals>
Definition at line 241 of file AtomicSharedPtr.h.
References c, count, diff(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::EXTERNAL_OFFSET, folly::PackedSyncPtr< T >::get(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::get_local_count(), and int64_t.
Referenced by folly::atomic_shared_ptr< T, Atom, CountedDetail >::compare_exchange_weak(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::exchange(), and folly::atomic_shared_ptr< T, Atom, CountedDetail >::store().
248 CountedDetail::template release_shared<T>(res.get(),
diff);
unsigned int get_local_count(const PackedPtr &p) const
static constexpr unsigned EXTERNAL_OFFSET
uint64_t diff(uint64_t a, uint64_t b)
template<typename T, template< typename > class Atom = std::atomic, typename CountedDetail = detail::shared_ptr_internals>
Definition at line 116 of file AtomicSharedPtr.h.
References folly::atomic_shared_ptr< T, Atom, CountedDetail >::get_newptr(), folly::gen::move, order, folly::atomic_shared_ptr< T, Atom, CountedDetail >::ptr_, and folly::atomic_shared_ptr< T, Atom, CountedDetail >::release_external().
Referenced by folly::atomic_shared_ptr< T, Atom, CountedDetail >::atomic_shared_ptr(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::operator=(), and folly::atomic_shared_ptr< T, Atom, CountedDetail >::~atomic_shared_ptr().
constexpr detail::Map< Move > move
AtomicStruct< PackedPtr, Atom > ptr_
void release_external(PackedPtr &res, int64_t c=0) const
PackedPtr get_newptr(const SharedPtr &n) const
template<typename T, template< typename > class Atom = std::atomic, typename CountedDetail = detail::shared_ptr_internals>
Definition at line 342 of file AtomicSharedPtr.h.
References folly::AtomicStruct< T, Atom >::compare_exchange_weak(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::EXTERNAL_OFFSET, folly::PackedSyncPtr< T >::extra(), folly::PackedSyncPtr< T >::get(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::get_local_count(), folly::AtomicStruct< T, Atom >::load(), folly::fibers::local(), order, folly::atomic_shared_ptr< T, Atom, CountedDetail >::putOwnedBase(), folly::PackedSyncPtr< T >::setExtra(), and folly::fibers::yield().
Referenced by folly::atomic_shared_ptr< T, Atom, CountedDetail >::compare_exchange_weak(), and folly::atomic_shared_ptr< T, Atom, CountedDetail >::load().
344 local =
ptr_.load(std::memory_order_acquire);
355 local =
ptr_.load(std::memory_order_acquire);
357 newlocal.setExtra(newlocal.extra() + 1);
359 if (
ptr_.compare_exchange_weak(local, newlocal,
order)) {
368 CountedDetail::inc_shared_count(newlocal.get(), batchcount);
unsigned int get_local_count(const PackedPtr &p) const
AtomicStruct< PackedPtr, Atom > ptr_
void putOwnedBase(BasePtr *p, unsigned int count, std::memory_order mo) const noexcept
static constexpr unsigned EXTERNAL_OFFSET
folly::PackedSyncPtr< BasePtr > PackedPtr