libtasks Documentation
1.6
|
Base class for objects/tasks that can be deleted. More...
#include <disposable.h>
Public Member Functions | |
disposable () | |
virtual | ~disposable () |
bool | can_dispose () const |
Check if a task can be disposed or not. More... | |
void | disable_dispose () |
Mark a task for being not disposable. More... | |
void | enable_dispose () |
Mark a task for being disposable. More... | |
virtual void | dispose (worker *)=0 |
Dispose an object. More... | |
Private Attributes | |
std::atomic< bool > | m_can_dispose |
Base class for objects/tasks that can be deleted.
We implement a simplistic garbage collector using timer tasks. If a task with auto_delete enabled can't be deleted directly by a worker thread, a dispose_task gets created that periodically tries to delete the task.
Definition at line 23 of file disposable.h.
|
inline |
Definition at line 25 of file disposable.h.
|
inlinevirtual |
Definition at line 26 of file disposable.h.
|
inline |
Check if a task can be disposed or not.
Definition at line 33 of file disposable.h.
|
inline |
Mark a task for being not disposable.
Definition at line 38 of file disposable.h.
|
pure virtual |
Dispose an object.
Dispose is called to delete a task. Instead of calling delete directly we enable for hooking in here. This is required by the net_io_task for example to stop the watcher.
Implemented in tasks::io_task_base.
|
inline |
Mark a task for being disposable.
Definition at line 43 of file disposable.h.
|
private |
Definition at line 54 of file disposable.h.