libcopp
1.1.0
|
task manager More...
#include <task_manager.h>
Data Structures | |
struct | flag_guard_t |
struct | flag_t |
Public Types | |
typedef TTask | task_t |
typedef TTaskContainer | container_t |
typedef task_t::id_t | id_t |
typedef task_t::ptr_t | task_ptr_t |
typedef task_manager< task_t, container_t > | self_t |
typedef std::shared_ptr< self_t > | ptr_t |
Public Member Functions | |
task_manager () | |
~task_manager () | |
void | reset () |
int | add_task (const task_ptr_t &task, time_t timeout_sec, int timeout_nsec) |
add task to manager please make the task has method of get_id() and will return a unique id More... | |
int | add_task (const task_ptr_t &task) |
add task to manager please make the task has method of get_id() and will return a unique id More... | |
int | remove_task (id_t id) |
remove task in this manager More... | |
task_ptr_t | find_task (id_t id) |
find task by id More... | |
int | start (id_t id, void *priv_data=NULL) |
int | resume (id_t id, void *priv_data=NULL) |
int | cancel (id_t id, void *priv_data=NULL) |
int | kill (id_t id, enum EN_TASK_STATUS status, void *priv_data=NULL) |
int | kill (id_t id, void *priv_data=NULL) |
int | tick (time_t sec, int nsec=0) |
active tick event and deal with clock More... | |
size_t | get_tick_checkpoint_size () const UTIL_CONFIG_NOEXCEPT |
get timeout checkpoint number in this manager More... | |
size_t | get_task_size () const UTIL_CONFIG_NOEXCEPT |
get task number in this manager More... | |
detail::tickspec_t | get_last_tick_time () const UTIL_CONFIG_NOEXCEPT |
get last tick time More... | |
const container_t & | get_container () const UTIL_CONFIG_NOEXCEPT |
task container, this api is just used for provide information to users More... | |
const std::multimap< detail::tickspec_t, id_t > & | get_checkpoints () const UTIL_CONFIG_NOEXCEPT |
get all task checkpoints, this api is just used for provide information to users More... | |
Static Public Member Functions | |
static ptr_t | create () |
create a new task manager More... | |
Private Attributes | |
container_t | tasks_ |
detail::tickspec_t | last_tick_time_ |
std::multimap< detail::tickspec_t, id_t > | task_timeout_checkpoints_ |
util::lock::spin_lock | action_lock_ |
int | flags_ |
task manager
Definition at line 56 of file task_manager.h.
typedef TTaskContainer cotask::task_manager< TTask, TTaskContainer >::container_t |
Definition at line 59 of file task_manager.h.
typedef task_t::id_t cotask::task_manager< TTask, TTaskContainer >::id_t |
Definition at line 60 of file task_manager.h.
typedef std::shared_ptr<self_t> cotask::task_manager< TTask, TTaskContainer >::ptr_t |
Definition at line 63 of file task_manager.h.
typedef task_manager<task_t, container_t> cotask::task_manager< TTask, TTaskContainer >::self_t |
Definition at line 62 of file task_manager.h.
typedef task_t::ptr_t cotask::task_manager< TTask, TTaskContainer >::task_ptr_t |
Definition at line 61 of file task_manager.h.
typedef TTask cotask::task_manager< TTask, TTaskContainer >::task_t |
Definition at line 58 of file task_manager.h.
|
inline |
Definition at line 95 of file task_manager.h.
|
inline |
Definition at line 100 of file task_manager.h.
|
inline |
add task to manager please make the task has method of get_id() and will return a unique id
task | task to be inserted |
timeout_sec | timeout in second ( unix time stamp recommanded ) |
timeout_nsec | timeout in nanosecond ( must be in the range 0-999999999 ) |
Definition at line 154 of file task_manager.h.
References copp::COPP_EC_ALREADY_EXIST, copp::COPP_EC_ARGS_ERROR, copp::COPP_EC_CAST_FAILED, copp::COPP_EC_EXTERNAL_INSERT_FAILED, copp::COPP_EC_IN_RESET, copp::COPP_EC_SUCCESS, cotask::task_mgr_node< TTask >::expired_time_, and cotask::task_mgr_node< TTask >::task_.
|
inline |
add task to manager please make the task has method of get_id() and will return a unique id
task | task to be inserted |
Definition at line 208 of file task_manager.h.
References cotask::task_manager< TTask, TTaskContainer >::add_task().
Referenced by cotask::task_manager< TTask, TTaskContainer >::add_task().
|
inline |
Definition at line 344 of file task_manager.h.
References copp::COPP_EC_IN_RESET, copp::COPP_EC_NOT_FOUND, and COPP_MACRO_STD_MOVE.
|
inlinestatic |
create a new task manager
Definition at line 139 of file task_manager.h.
|
inline |
find task by id
id | task id |
Definition at line 250 of file task_manager.h.
|
inline |
get all task checkpoints, this api is just used for provide information to users
Definition at line 516 of file task_manager.h.
|
inline |
task container, this api is just used for provide information to users
Definition at line 510 of file task_manager.h.
|
inline |
|
inline |
|
inline |
get timeout checkpoint number in this manager
Definition at line 492 of file task_manager.h.
|
inline |
Definition at line 373 of file task_manager.h.
References copp::COPP_EC_IN_RESET, copp::COPP_EC_NOT_FOUND, and COPP_MACRO_STD_MOVE.
|
inline |
Definition at line 402 of file task_manager.h.
References cotask::EN_TS_KILLED, and cotask::task_manager< TTask, TTaskContainer >::kill().
Referenced by cotask::task_manager< TTask, TTaskContainer >::kill().
|
inline |
remove task in this manager
id | task id |
Definition at line 215 of file task_manager.h.
References copp::COPP_EC_IN_RESET, copp::COPP_EC_NOT_FOUND, copp::COPP_EC_SUCCESS, COPP_MACRO_STD_MOVE, cotask::EN_TS_CREATED, cotask::EN_TS_DONE, and cotask::EN_TS_KILLED.
|
inline |
Definition at line 105 of file task_manager.h.
References cotask::EN_TS_KILLED.
|
inline |
Definition at line 307 of file task_manager.h.
References copp::COPP_EC_IN_RESET, copp::COPP_EC_NOT_FOUND, and cotask::EN_TS_DONE.
|
inline |
Definition at line 270 of file task_manager.h.
References copp::COPP_EC_IN_RESET, copp::COPP_EC_NOT_FOUND, and cotask::EN_TS_DONE.
|
inline |
active tick event and deal with clock
sec | current time in second ( unix time stamp recommanded ) |
nsec | current time in nanosecond ( must be in the range 0-999999999 ) |
Definition at line 412 of file task_manager.h.
References copp::COPP_EC_IN_RESET, copp::COPP_EC_SUCCESS, COPP_MACRO_STD_MOVE, cotask::EN_TS_TIMEOUT, cotask::detail::tickspec_t::tv_nsec, and cotask::detail::tickspec_t::tv_sec.
|
private |
Definition at line 526 of file task_manager.h.
|
private |
Definition at line 528 of file task_manager.h.
|
private |
Definition at line 522 of file task_manager.h.
|
private |
Definition at line 523 of file task_manager.h.
|
private |
Definition at line 521 of file task_manager.h.