libtasks Documentation  1.6
tasks::task Class Reference

The base class for any task. More...

#include <task.h>

Inheritance diagram for tasks::task:
Collaboration diagram for tasks::task:

Classes

struct  finish_func_t
 

Public Types

typedef std::function< void(worker
*worker)> 
finish_func_worker_t
 
typedef std::function< void()> finish_func_void_t
 

Public Member Functions

virtual ~task ()
 
bool auto_delete () const
 Returns true if auto deletion is active. More...
 
void disable_auto_delete ()
 Call this to deactivate auto deletion. More...
 
void finish (worker *worker=nullptr)
 Called by a worker when a task has auto_deletion enabled. More...
 
void on_finish (finish_func_worker_t f)
 
void on_finish (finish_func_void_t f)
 

Private Attributes

bool m_auto_delete = true
 
std::vector< finish_func_tm_finish_funcs
 

Detailed Description

The base class for any task.

Definition at line 19 of file task.h.

Member Typedef Documentation

typedef std::function<void()> tasks::task::finish_func_void_t

Definition at line 22 of file task.h.

typedef std::function<void(worker* worker)> tasks::task::finish_func_worker_t

Definition at line 21 of file task.h.

Constructor & Destructor Documentation

virtual tasks::task::~task ( )
inlinevirtual

Definition at line 43 of file task.h.

Member Function Documentation

bool tasks::task::auto_delete ( ) const
inline

Returns true if auto deletion is active.

Definition at line 46 of file task.h.

Here is the caller graph for this function:

void tasks::task::disable_auto_delete ( )
inline

Call this to deactivate auto deletion.

Definition at line 49 of file task.h.

void tasks::task::finish ( worker worker = nullptr)

Called by a worker when a task has auto_deletion enabled.

Definition at line 13 of file task.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::task::on_finish ( finish_func_worker_t  f)
inline

If a task finishes it can execute callback functions. Note that no locks will be used at this level.

Definition at line 56 of file task.h.

Here is the caller graph for this function:

void tasks::task::on_finish ( finish_func_void_t  f)
inline

If a task finishes it can execute callback functions. Note that no locks will be used at this level.

Definition at line 62 of file task.h.

Member Data Documentation

bool tasks::task::m_auto_delete = true
private

Definition at line 69 of file task.h.

std::vector<finish_func_t> tasks::task::m_finish_funcs
private

Definition at line 71 of file task.h.


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