folly::EnablePrimaryFromThis

EnablePrimaryFromThis provides an object with appropriate access to the functionality of the PrimaryPtr holding this.

Synopsis

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

template<typename T>
class EnablePrimaryFromThis;

Member Functions

NameDescription
masterLockFromThis masterLockFromThis overloads
masterRefFromThis masterRefFromThis overloads

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.