libcopp
2.2.0
|
#include <task_impl.h>
Data Structures | |
struct | ext_coroutine_flag_t |
Public Types | |
using | id_type = LIBCOPP_COPP_NAMESPACE_ID::util::uint64_id_allocator::value_type |
using | id_allocator_type = LIBCOPP_COPP_NAMESPACE_ID::util::uint64_id_allocator |
using | id_t = id_type |
using | id_allocator_t = id_allocator_type |
Public Member Functions | |
LIBCOPP_COTASK_API | task_impl () |
virtual LIBCOPP_COTASK_API | ~task_impl ()=0 |
UTIL_FORCEINLINE id_type | get_id () const LIBCOPP_MACRO_NOEXCEPT |
UTIL_FORCEINLINE EN_TASK_STATUS | get_status () const LIBCOPP_MACRO_NOEXCEPT |
virtual LIBCOPP_COTASK_API bool | is_canceled () const LIBCOPP_MACRO_NOEXCEPT |
virtual LIBCOPP_COTASK_API bool | is_completed () const LIBCOPP_MACRO_NOEXCEPT |
virtual LIBCOPP_COTASK_API bool | is_faulted () const LIBCOPP_MACRO_NOEXCEPT |
virtual LIBCOPP_COTASK_API bool | is_timeout () const LIBCOPP_MACRO_NOEXCEPT |
LIBCOPP_COTASK_API bool | is_exiting () const LIBCOPP_MACRO_NOEXCEPT |
check if a cotask is exiting More... | |
virtual LIBCOPP_COTASK_API int | get_ret_code () const =0 |
virtual int | start (void *priv_data, EN_TASK_STATUS expected_status=EN_TS_CREATED)=0 |
virtual int | resume (void *priv_data, EN_TASK_STATUS expected_status=EN_TS_WAITING)=0 |
virtual int | yield (void **priv_data)=0 |
virtual int | cancel (void *priv_data)=0 |
virtual int | kill (enum EN_TASK_STATUS status, void *priv_data)=0 |
UTIL_FORCEINLINE int | kill (void *priv_data) |
UTIL_FORCEINLINE int | start () |
UTIL_FORCEINLINE int | resume () |
UTIL_FORCEINLINE int | yield () |
UTIL_FORCEINLINE int | cancel () |
UTIL_FORCEINLINE int | kill (enum EN_TASK_STATUS status) |
UTIL_FORCEINLINE int | kill () |
virtual LIBCOPP_COTASK_API int | on_finished () |
UTIL_FORCEINLINE action_ptr_type | get_raw_action () const LIBCOPP_MACRO_NOEXCEPT |
get raw action pointer More... | |
Static Public Member Functions | |
static LIBCOPP_COTASK_API task_impl * | this_task () |
Protected Types | |
using | action_ptr_type = task_action_impl * |
using | action_ptr_t = action_ptr_type |
Protected Member Functions | |
LIBCOPP_COTASK_API void | _set_action (action_ptr_type action) |
LIBCOPP_COTASK_API action_ptr_type | _get_action () |
LIBCOPP_COTASK_API bool | _cas_status (EN_TASK_STATUS &expected, EN_TASK_STATUS desired) |
LIBCOPP_COTASK_API int | _notify_finished (void *priv_data) |
Protected Attributes | |
void * | finish_priv_data_ |
Private Member Functions | |
task_impl (const task_impl &)=delete | |
task_impl & | operator= (const task_impl &)=delete |
task_impl (const task_impl &&)=delete | |
task_impl & | operator= (const task_impl &&)=delete |
Private Attributes | |
action_ptr_type | action_ |
id_type | id_ |
LIBCOPP_COPP_NAMESPACE_ID::util::lock::atomic_int_type< uint32_t > | status_ |
Definition at line 40 of file task_impl.h.
|
protected |
Definition at line 53 of file task_impl.h.
|
protected |
Definition at line 50 of file task_impl.h.
Definition at line 47 of file task_impl.h.
using impl::task_impl::id_allocator_type = LIBCOPP_COPP_NAMESPACE_ID::util::uint64_id_allocator |
Definition at line 43 of file task_impl.h.
using impl::task_impl::id_t = id_type |
Definition at line 46 of file task_impl.h.
using impl::task_impl::id_type = LIBCOPP_COPP_NAMESPACE_ID::util::uint64_id_allocator::value_type |
Definition at line 42 of file task_impl.h.
|
privatedelete |
|
privatedelete |
LIBCOPP_COTASK_API impl::task_impl::task_impl | ( | ) |
Definition at line 23 of file task_impl.cpp.
References id_.
|
pure virtual |
Definition at line 30 of file task_impl.cpp.
References EN_TS_DONE, and id_.
|
protected |
Definition at line 69 of file task_impl.cpp.
References util::lock::memory_order_acq_rel, util::lock::memory_order_acquire, and status_.
Referenced by task< TCO_MACRO >::cancel(), task< TCO_MACRO >::kill(), and task< TCO_MACRO >::start().
|
protected |
|
protected |
Definition at line 81 of file task_impl.cpp.
References _get_action(), COPP_EC_HAS_UNHANDLE_EXCEPTION, finish_priv_data_, on_finished(), and impl::task_action_impl::on_finished().
Referenced by task< TCO_MACRO >::_notify_finished(), task< TCO_MACRO >::cancel(), task< TCO_MACRO >::kill(), and task< TCO_MACRO >::start().
|
protected |
Definition at line 65 of file task_impl.cpp.
References print_color::action, and action_.
|
inline |
|
pure virtual |
Implemented in task< TCO_MACRO >, and task< TCO_MACRO >.
|
inline |
Definition at line 74 of file task_impl.h.
Referenced by task_manager< task< TCO_MACRO > >::add_task(), and main().
|
inline |
get raw action pointer
Definition at line 132 of file task_impl.h.
|
pure virtual |
Implemented in task< TCO_MACRO >, and task< TCO_MACRO >.
|
inline |
get task status
Definition at line 80 of file task_impl.h.
References util::lock::memory_order_acquire.
Referenced by task< TCO_MACRO >::cancel(), is_canceled(), is_exiting(), is_faulted(), is_timeout(), task< TCO_MACRO >::kill(), and task< TCO_MACRO >::~task().
|
virtual |
Definition at line 39 of file task_impl.cpp.
References EN_TS_CANCELED, and get_status().
|
virtual |
Reimplemented in task< TCO_MACRO >, and task< TCO_MACRO >.
Definition at line 41 of file task_impl.cpp.
References is_exiting().
Referenced by task< TCO_MACRO >::next(), and task< TCO_MACRO >::start().
LIBCOPP_COTASK_API bool impl::task_impl::is_exiting | ( | ) | const |
check if a cotask is exiting
Definition at line 47 of file task_impl.cpp.
References EN_TS_DONE, and get_status().
Referenced by task_manager< task< TCO_MACRO > >::add_task(), task< TCO_MACRO >::await_task(), is_completed(), and task< TCO_MACRO >::next().
|
virtual |
Definition at line 43 of file task_impl.cpp.
References EN_TS_KILLED, and get_status().
|
virtual |
Definition at line 45 of file task_impl.cpp.
References EN_TS_TIMEOUT, and get_status().
|
inline |
Definition at line 112 of file task_impl.h.
References kill().
Referenced by kill(), and task< TCO_MACRO >::~task().
|
inline |
|
pure virtual |
Implemented in task< TCO_MACRO >, and task< TCO_MACRO >.
|
inline |
Definition at line 105 of file task_impl.h.
References EN_TS_KILLED, and kill().
Referenced by kill().
|
virtual |
Definition at line 49 of file task_impl.cpp.
Referenced by _notify_finished().
|
inline |
|
pure virtual |
Implemented in task< TCO_MACRO >, and task< TCO_MACRO >.
|
inline |
Definition at line 107 of file task_impl.h.
References start().
Referenced by task< TCO_MACRO >::resume(), and start().
|
pure virtual |
Implemented in task< TCO_MACRO >, and task< TCO_MACRO >.
|
static |
get current running task
Definition at line 51 of file task_impl.cpp.
References impl::task_impl::ext_coroutine_flag_t::EN_ECFT_COTASK.
Referenced by task< TCO_MACRO >::await_task(), this_task::get_task(), and task< TCO_MACRO >::this_task().
|
inline |
Definition at line 109 of file task_impl.h.
References yield().
Referenced by task< TCO_MACRO >::await_task(), and yield().
|
pure virtual |
Implemented in task< TCO_MACRO >, and task< TCO_MACRO >.
Referenced by main().
|
private |
Definition at line 147 of file task_impl.h.
Referenced by _get_action(), and _set_action().
|
protected |
Definition at line 151 of file task_impl.h.
Referenced by _notify_finished().
|
private |
Definition at line 148 of file task_impl.h.
Referenced by task_impl(), and ~task_impl().
|
private |
Definition at line 155 of file task_impl.h.
Referenced by _cas_status().