35#ifndef MADNESS_WORLD_DEFERRED_CLEANUP_H__INCLUDED
36#define MADNESS_WORLD_DEFERRED_CLEANUP_H__INCLUDED
45 template <
typename,
typename>
51 template <
typename objT>
52 inline void deferred_cleanup(
World& world,
const std::shared_ptr<objT>&
p,
bool assume_p_is_unique =
false);
77 template <
typename objT>
115 template <
typename objT>
116 void add(
const std::shared_ptr<objT>& obj) {
117 add(std::static_pointer_cast<void>(obj));
134 template <
typename objT>
136 bool assume_p_is_unique) {
137 const auto p_is_unique =
p.use_count() == 1;
138 if(p_is_unique || assume_p_is_unique) {
double w(double t, double eps)
Definition DKops.h:22
Definition deferred_cleanup.h:46
Recursive mutex using pthread mutex operations.
Definition worldmutex.h:185
A parallel world class.
Definition world.h:132
Deferred cleanup of shared_ptr's.
Definition deferred_cleanup.h:60
DeferredCleanup & operator=(const DeferredCleanup &)
std::shared_ptr< void > void_ptr
input pointer type
Definition deferred_cleanup.h:62
friend void deferred_cleanup(World &, const std::shared_ptr< objT > &, bool)
Defer the cleanup of a shared pointer to the end of the next fence.
Definition deferred_cleanup.h:135
void_ptr_list deferred_
List of pointers to cleanup.
Definition deferred_cleanup.h:68
static std::shared_ptr< DeferredCleanup > get_deferred_cleanup(const World &w)
Access deferred cleanup object of world.
Definition deferred_cleanup.cc:71
void add(const std::shared_ptr< objT > &obj)
Adds item to cleanup list.
Definition deferred_cleanup.h:116
void add(const void_ptr &obj)
Adds item to cleanup list.
Definition deferred_cleanup.cc:51
void do_cleanup()
Deletes/frees any pointers that are in the list.
Definition deferred_cleanup.cc:59
DeferredCleanup()
Construct a deferred deleter object.
Definition deferred_cleanup.h:88
bool destroy_
Definition deferred_cleanup.h:69
std::list< void_ptr > void_ptr_list
Definition deferred_cleanup.h:65
bool destroy() const
Get the current destruction mode mode.
Definition deferred_cleanup.cc:44
DeferredCleanup(const DeferredCleanup &)
RecursiveMutex mutex_
Worldwide mutex.
Definition deferred_cleanup.h:67
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
void deferred_cleanup(World &world, const std::shared_ptr< objT > &p, bool assume_p_is_unique=false)
Defer the cleanup of a shared pointer to the end of the next fence.
Definition deferred_cleanup.h:135
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
Implements Mutex, MutexFair, Spinlock, ConditionVariable.