5#include <system/object.h>
6#include <system/collections/ienumerable.h>
7#include <system/threading/tasks/task.h>
8#include <system/threading/tasks/result_task.h>
9#include <system/threading/tasks/async.h>
10#include <system/array.h>
16namespace Runtime {
namespace CompilerServices {
28 static constexpr bool continueOnCapturedContext =
false;
41class CancellationToken;
78template<
typename TResult>
81 return MakeAsync<TResult>([=](System::Details::ResultAsyncContext<TResult>& __context) { exception.Throw(); });
99template <
typename TResult>
102 return MakeObject<ResultTask<TResult>>(result);
109template <
typename TResult>
112 auto result = MakeObject<ResultTask<TResult>>(function);
145 return WhenAll(tasks->LINQ_ToArray());
175 return MakeAsync<ArrayPtr<T>>([=](System::Details::ResultAsyncContext<ArrayPtr<T>>& __context)
177 for (
auto& task : tasks)
179 if (!task->get_IsCompleted())
185 auto size = tasks->get_Length();
186 auto result = MakeArray<T>(size);
187 for (
auto i = 0; i < size; ++ i)
189 result[i] = tasks[i]->get_Result();
191 __context.Return(result);
Interface of object providing enumerator on contained elements.
Definition: ienumerable.h:25
Template that represents wrapper of exceptions that are derived from Exception class.
Definition: exception.h:113
Function delegate. This type should be allocated on stack and passed to functions by value or by refe...
Definition: func.h:82
Definition: task_utils.h:22
void OnCompleted(const Action<> &continuation)
bool get_IsCompleted() const
Definition: task_utils.h:24
void GetResult() const
Definition: task_utils.h:26
Definition: task_utils.h:19
YieldAwaiter GetAwaiter() const
Definition: task_utils.h:31
Propagates notification that operations should be canceled. This class provides a mechanism for coope...
Definition: cancellation_token.h:43
void Start()
Starts the task execution using the default scheduler.
TaskPtr Delay(int32_t millisecondsDelay)
Creates a task that completes after a time delay.
TaskPtr WhenAll(const ArrayPtr< TaskPtr > &tasks)
TaskPtr Run(const Action<> &action)
TaskPtr FromException(const Exception &exception)
RTaskPtr< TResult > FromResult(TResult result)
Definition: task_utils.h:100
Runtime::CompilerServices::YieldAwaitable Yield()
Definition: db_command.h:9
MulticastDelegate< void(Args...)> Action
Delegate type that references methods that have no return value.
Definition: action.h:40