libtasks Documentation
1.6
|
#include <timer_task.h>
Public Member Functions | |
timer_task (double after, double repeat) | |
virtual | ~timer_task () |
std::string | get_string () const |
ev_timer * | watcher () const |
double | after () const |
double | repeat () const |
void | init_watcher () |
Initialize the underlying watcher object. More... | |
void | start_watcher (worker *worker) |
Activate the underlying watcher to listen for I/O or timer events. More... | |
void | stop_watcher (worker *worker) |
Deactivate the underlying watcher. More... | |
![]() | |
virtual | ~event_task () |
virtual bool | handle_event (worker *worker, int events)=0 |
worker * | assigned_worker () const |
Returns a pointer to the assigned worker. More... | |
void | assign_worker (worker *worker) |
void | notify_error (worker *worker=nullptr) |
void | on_error (error_func_worker_t f) |
void | on_error (error_func_void_t f) |
Install an error callback. More... | |
![]() | |
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) |
![]() | |
error_base () | |
virtual | ~error_base () |
bool | error () const |
Return true if an error occured. More... | |
tasks_error | error_code () const |
Return the error code. More... | |
const std::string & | error_message () const |
Return the error message. More... | |
int | sys_errno () const |
Return the errno if available. More... | |
std::string | sys_errno_str () const |
Return the errno description if available. More... | |
const tasks_exception & | exception () const |
Return the underlying exception object. More... | |
void | set_exception (tasks_exception &e) |
Set an exception to report an error. More... | |
void | reset_error () |
Reset the error state. More... | |
Private Attributes | |
std::unique_ptr< ev_timer > | m_timer |
double | m_after = 0 |
double | m_repeat = 0. |
Additional Inherited Members | |
![]() | |
typedef std::function< void(worker *worker, const tasks_exception &e)> | error_func_worker_t |
typedef std::function< void(const tasks_exception &e)> | error_func_void_t |
![]() | |
typedef std::function< void(worker *worker)> | finish_func_worker_t |
typedef std::function< void()> | finish_func_void_t |
Definition at line 20 of file timer_task.h.
tasks::timer_task::timer_task | ( | double | after, |
double | repeat | ||
) |
|
virtual |
|
inline |
|
inline |
|
inlinevirtual |
Initialize the underlying watcher object.
Implements tasks::event_task.
Definition at line 37 of file timer_task.h.
|
inline |
|
virtual |
Activate the underlying watcher to listen for I/O or timer events.
Implements tasks::event_task.
Definition at line 25 of file timer_task.cpp.
|
virtual |
Deactivate the underlying watcher.
Implements tasks::event_task.
Definition at line 34 of file timer_task.cpp.
|
inline |
Definition at line 31 of file timer_task.h.
|
private |
Definition at line 43 of file timer_task.h.
|
private |
Definition at line 44 of file timer_task.h.
|
private |
Definition at line 42 of file timer_task.h.