Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
AsyncDeleter< T > Class Template Reference

#include <async-deleter.hh>

Collaboration diagram for AsyncDeleter< T >:
Collaboration graph

Public Member Functions

 AsyncDeleter ()
 
void operator() (T *p)
 

Private Attributes

ThreadPool::Ptr deleter
 

Detailed Description

template<typename T>
class AsyncDeleter< T >

Allow boost shared pointers to asynchronously delete their targets.

When some objects last shared pointer goes out of scope, the object is deleted. Usually, this is done on the thread that destroys the last pointer. This class allows destruction to be done on a separate thread.

This is especially advantageous if deleting the object takes a long time and there is no immediate hurry. Deleting ThreadPool::Queue objects, for example, blocks as long as a thread is currently executing a job on the queue. This might take some time you do not wish to wait.

Constructor & Destructor Documentation

◆ AsyncDeleter()

template<typename T >
AsyncDeleter< T >::AsyncDeleter ( )
inline
49 {
50 }
ThreadPool::Ptr deleter
Definition async-deleter.hh:44
::ThreadPool::Ptr getDeleter()
Definition async-deleter.cc:15

Member Function Documentation

◆ operator()()

template<typename T >
void AsyncDeleter< T >::operator() ( T *  p)
inline
53 {
54 deleter->schedule([p] { Detail::call_delete(p); });
55 }
PresentationInterfaceStub::Ptr const p
Definition determine-size-test.cc:172
void call_delete(T *p)
Definition async-deleter.hh:15
Here is the call graph for this function:

Member Data Documentation

◆ deleter

template<typename T >
ThreadPool::Ptr AsyncDeleter< T >::deleter
private

The documentation for this class was generated from the following file: