Add Support for nested MasterPtr and Cleanup tasks
Summary: Allow a T that derives from EnableMasterFromThis<T> to use masterLockFromThis() to get a non-owning shared_ptr to this and to use masterRefFromThis() to get a MasterPtrRef<> from this. Adds MasterPtr::cleanup() that returns SemiFuture<Unit>. join() just does a blocking wait on the SemiFuture returned from cleanup(). Allows a T to provide a T::cleanup() method that will be composed into the MasterPtr::cleanup() work. MasterPtr now uses SemiFuture<Unit> instead of Baton. This allows users of MasterPtr::cleanup() to compose cleanup work with other tasks. Andrii suggested that the cleanup feature be extracted out of MasterPtr Adds cleanup traits (that MasterPtr satisfies) and a Cleanup type that satisfies the cleanup traits and allows objects that are not heap-allocated to participate in structured concurrency by deriving from Cleanup. Reviewed By: andriigrynenko Differential Revision: D19584561 fbshipit-source-id: aa2d608effe613ec84b08f902a1c61561f3458bb
Showing
folly/experimental/Cleanup.h
0 → 100644
Please register or sign in to comment