Represents a base class for asynchronous operation.
Public Fields | |
| static constexpr xtd::usize | wait_timeout |
| Indicates that a xtd::threading::wait_handle::wait_any operation timed out before any of the wait handles were signaled. This field is constant. | |
Public Constructors | |
| basic_task (const xtd::func< result_t > &funcfunc) | |
| Initializes a new xtd::threading::tasks::basic_task <result_t> with the specified function. | |
| basic_task (const xtd::func< result_t > &funcfunc, const xtd::threading::cancellation_token &cancellation_token) | |
| basic_task (const xtd::func< result_t, const xtd::any_object & > &funcfunc, const xtd::any_object &state) | |
| basic_task (const xtd::func< result_t > &funcfunc, const xtd::any_object &state, const xtd::threading::cancellation_token &cancellation_token) | |
Public Properties | |
| auto | async_state () const noexcept -> xtd::any_object override |
| Gets a user-defined object that qualifies or contains information about an asynchronous operation. | |
| auto | creation_options () const noexcept -> xtd::threading::tasks::task_creation_options |
| auto | exception () const noexcept -> xtd::ref< xtd::exception > |
| auto | id () const noexcept -> xtd::usize override |
| Gets an ID for this xtd::threading::tasks::task instance. | |
| auto | is_canceled () const noexcept -> bool |
| auto | is_completed () const noexcept -> bool override |
| Gets a value that indicates whether the asynchronous operation has completed. | |
| auto | is_faulted () const noexcept -> bool |
| auto | status () const noexcept -> xtd::threading::tasks::task_status |
Public Methods | |
| auto | continue_with (xtd::action<> continuation) -> void |
| auto | rethrow_exception () -> void |
| auto | run_synchronously () -> void |
| auto | start () -> void override |
| Starts the xtd::threading::tasks::task, scheduling it for execution to the current xtd::threading::tasks::task_scheduler. | |
| auto | wait () -> void override |
| Waits for the xtd::threading::tasks::task to complete execution. | |
| auto | wait (xtd::int32 milliseconds_timeout) -> bool override |
| Waits for the xtd::threading::tasks::task to complete execution with specified milliseconds timout. | |
| auto | wait (xtd::int32 milliseconds_timeout, xtd::threading::cancellation_token &cancellation_token) -> bool override |
| Waits for the xtd::threading::tasks::task to complete execution with specified milliseconds timout and cancellation token. | |
| auto | wait (const xtd::time_span &timeout) -> bool override |
| Waits for the xtd::threading::tasks::task to complete execution with specified timout. | |
| auto | wait (const xtd::time_span &timeout, xtd::threading::cancellation_token &cancellation_token) -> bool override |
| Waits for the xtd::threading::tasks::task to complete execution with specified timout and cancellation token. | |
Public Static Properties | |
| static auto | completed_task () -> task< result_t > |
| static auto | current_id () noexcept -> xtd::usize |
| static auto | factory () noexcept -> const xtd::threading::tasks::task_factory & |
Public Static Methods | |
| static auto | from_cancelation (const xtd::threading::cancellation_token &cancellation_token) -> task< result_t > |
| template<typename from_exception_t> | |
| static auto | from_exception (from_exception_t exception) -> task< result_t > |
| static auto | delay (const xtd::time_span &delay) -> task<> |
| static auto | delay (const xtd::time_span &delay, const xtd::threading::cancellation_token &cancellation_token) -> task<> |
| static auto | delay (xtd::int32 milliseconds_delay) -> task<> |
| static auto | delay (xtd::int32 milliseconds_delay, const xtd::threading::cancellation_token &cancellation_token) -> task<> |
| static auto | run (const xtd::func< result_t > &funcfunc) -> task< result_t > |
| static auto | run (const xtd::func< result_t > &funcfunc, const xtd::threading::cancellation_token &cancellation_token) -> task< result_t > |
| static auto | run (const xtd::func< result_t, const xtd::any_object & > &funcfunc, const xtd::any_object &state) -> task< result_t > |
| static auto | run (const xtd::func< result_t, const xtd::any_object & > &funcfunc, const xtd::any_object &state, const xtd::threading::cancellation_token &cancellation_token) -> task< result_t > |
| template<typename collection_t> | |
| static auto | wait_all (const collection_t &tasks) -> bool |
| template<typename collection_t> | |
| static auto | wait_all (const collection_t &tasks, xtd::int32 milliseconds_timeout) -> bool |
| template<typename collection_t> | |
| static auto | wait_all (const collection_t &tasks, const xtd::time_span &timeout) -> bool |
| template<typename collection_t> | |
| static xtd::usize | wait_any (const collection_t &tasks) |
| template<typename collection_t> | |
| static xtd::usize | wait_any (const collection_t &tasks, int32 milliseconds_timeout) |
| template<typename collection_t> | |
| static xtd::usize | wait_any (const collection_t &tasks, const time_span &timeout) |
| template<typename ... items_t> | |
| static auto | when_all (items_t &&... items) -> task<> |
| template<typename ... items_t> | |
| static auto | when_any (items_t &&... items) -> task< xtd::usize > |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual auto | equals (const object &obj) const noexcept -> bool |
| Determines whether the specified object is equal to the current object. | |
| virtual auto | get_hash_code () const noexcept -> xtd::usize |
| Serves as a hash function for a particular type. | |
| virtual auto | get_type () const noexcept -> type_object |
| Gets the type of the current instance. | |
| template<typename object_t> | |
| auto | memberwise_clone () const -> xtd::unique_ptr_object< object_t > |
| Creates a shallow copy of the current object. | |
| virtual auto | to_string () const -> xtd::string |
| Returns a xtd::string that represents the current object. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are considered equal. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are the same instance. | |
|
inline |
Initializes a new xtd::threading::tasks::basic_task <result_t> with the specified function.
| func | The delegate that represents the code to execute in the task. When the function has completed, the task's xtd::threading::tasks::basic_task::result property will be set to return the result value of the function. |
|
inlinenodiscardoverridevirtualnoexcept |
Gets a user-defined object that qualifies or contains information about an asynchronous operation.
Implements xtd::iasync_result.
|
inlinenodiscardoverridevirtualnoexcept |
Gets an ID for this xtd::threading::tasks::task instance.
Implements xtd::threading::tasks::itask.
|
inlinenodiscardoverridevirtualnoexcept |
Gets a value that indicates whether the asynchronous operation has completed.
Implements xtd::iasync_result.
|
inlineoverridevirtual |
Starts the xtd::threading::tasks::task, scheduling it for execution to the current xtd::threading::tasks::task_scheduler.
Implements xtd::threading::tasks::itask.
|
inlineoverridevirtual |
Waits for the xtd::threading::tasks::task to complete execution.
Implements xtd::threading::tasks::itask.
|
inlineoverridevirtual |
Waits for the xtd::threading::tasks::task to complete execution with specified milliseconds timout.
| milliseconds_timeout | The number of milliseconds to wait, or xtd::threading::timeout::infinite (-1) to wait indefinitely. |
Implements xtd::threading::tasks::itask.
|
inlineoverridevirtual |
Waits for the xtd::threading::tasks::task to complete execution with specified milliseconds timout and cancellation token.
| milliseconds_timeout | The number of milliseconds to wait, or xtd::threading::timeout::infinite (-1) to wait indefinitely. |
Implements xtd::threading::tasks::itask.
|
inlineoverridevirtual |
Waits for the xtd::threading::tasks::task to complete execution with specified timout.
| timeout | A xtd::time_span that represents the number of milliseconds to wait, or a xtd::threading::timeout::infinite_time_span that represents -1 milliseconds to wait indefinitely. |
Implements xtd::threading::tasks::itask.
|
inlineoverridevirtual |
Waits for the xtd::threading::tasks::task to complete execution with specified timout and cancellation token.
| timeout | A xtd::time_span that represents the number of milliseconds to wait, or a xtd::threading::timeout::infinite_time_span that represents -1 milliseconds to wait indefinitely. |
Implements xtd::threading::tasks::itask.
|
staticconstexpr |
Indicates that a xtd::threading::wait_handle::wait_any operation timed out before any of the wait handles were signaled. This field is constant.