folly::PrimaryPtrRef

PrimaryPtrRef is a non-owning reference to the pointer. PrimaryPtr::join() and the PrimaryPtr::cleanup() work do NOT wait for outstanding PrimaryPtrRef objects to be released.

Synopsis

Declared in <folly/concurrency/memory/PrimaryPtr.h>

template<typename T>
class PrimaryPtrRef;

Member Functions

NameDescription
PrimaryPtrRef [constructor]Constructs an empty PrimaryPtrRef that references no pointer.
lock Attempts to lock a pointer.

Friends

NameDescription
folly::PrimaryPtrPrimaryPtr should be used to achieve deterministic destruction of objects with shared ownership. Once an object is managed by a PrimaryPtr, shared_ptrs can be obtained pointing to that object. However destroying those shared_ptrs will never call the object destructor inline. To destroy the object, join() method must be called on PrimaryPtr or the task returned from cleanup() must be completed, which will wait for all shared_ptrs to be released and then call the object destructor on the caller supplied execution context.
folly::EnablePrimaryFromThisEnablePrimaryFromThis provides an object with appropriate access to the functionality of the PrimaryPtr holding this.