|
MADNESS 0.10.1
|
Deferred cleanup of shared_ptr's. More...
#include <deferred_cleanup.h>

Public Types | |
| typedef std::shared_ptr< void > | void_ptr |
| input pointer type | |
Public Member Functions | |
| DeferredCleanup () | |
| Construct a deferred deleter object. | |
| template<typename objT> | |
| void | add (const std::shared_ptr< objT > &obj) |
Adds item to cleanup list. | |
| void | add (const void_ptr &obj) |
Adds item to cleanup list. | |
| bool | destroy () const |
| Get the current destruction mode mode. | |
| void | destroy (bool mode) |
| Set the destruction mode. | |
| void | do_cleanup () |
| Deletes/frees any pointers that are in the list. | |
Private Types | |
| typedef std::list< void_ptr > | void_ptr_list |
Private Member Functions | |
| DeferredCleanup (const DeferredCleanup &) | |
| DeferredCleanup & | operator= (const DeferredCleanup &) |
Static Private Member Functions | |
| static std::shared_ptr< DeferredCleanup > | get_deferred_cleanup (const World &w) |
| Access deferred cleanup object of world. | |
Private Attributes | |
| void_ptr_list | deferred_ |
| List of pointers to cleanup. | |
| bool | destroy_ |
| RecursiveMutex | mutex_ |
| Worldwide mutex. | |
Friends | |
| template<typename objT> | |
| void | deferred_cleanup (World &world, const std::shared_ptr< objT > &p, bool assume_p_is_unique) |
| Defer the cleanup of a shared pointer to the end of the next fence. | |
Deferred cleanup of shared_ptr's.
Holds dynamically allocated pointers until it is ready for cleanup.
DeferredDeleter with a std::shared_ptr. | typedef std::shared_ptr<void> madness::detail::DeferredCleanup::void_ptr |
input pointer type
|
private |
|
private |
References DeferredCleanup().
Referenced by DeferredCleanup(), and operator=().
|
inline |
|
inline |
Adds item to cleanup list.
If destroy mode is true then the pointer is destroyed immediately. Otherwise it is stored until do_cleanup() is called.
| objT | The object pointer type |
| obj | Object that is ready for destruction |
References add().
| void madness::detail::DeferredCleanup::add | ( | const void_ptr & | obj | ) |
Adds item to cleanup list.
If destroy mode is true then the pointer is destroyed immediately. Otherwise it is stored until do_cleanup() is called.
| obj | Object that is ready for destruction |
References deferred_, destroy_, and mutex_.
Referenced by add().
| bool madness::detail::DeferredCleanup::destroy | ( | ) | const |
| void madness::detail::DeferredCleanup::destroy | ( | bool | mode | ) |
| void madness::detail::DeferredCleanup::do_cleanup | ( | ) |
|
staticprivate |
Access deferred cleanup object of world.
| w | The World object that holds the DeferredCleanup object |
w. References w().
Referenced by deferred_cleanup.
|
private |
References DeferredCleanup(), and w().
|
friend |
Defer the cleanup of a shared pointer to the end of the next fence.
Call this function before destroying a shared pointer. If the shared pointer is the last reference to the object, or assume_p_is_unique is true, it is placed in the deferred deletion list. Otherwise, nothing is done with the pointer.
References get_deferred_cleanup(), and p().
|
private |
List of pointers to cleanup.
Referenced by DeferredCleanup(), add(), and do_cleanup().
|
private |
Object destroy mode true = destroy immediate false = destroy deferred (default)
Referenced by DeferredCleanup(), add(), destroy(), and destroy().
|
private |
Worldwide mutex.
Referenced by DeferredCleanup(), add(), destroy(), destroy(), and do_cleanup().