3#include "ImmediateScheduler.h"
4#include "cesium-async++.h"
13class QueuedScheduler {
18 void schedule(async::task_run_handle t);
19 void dispatchQueuedContinuations();
20 bool dispatchZeroOrOneContinuation();
22 template <
typename T> T dispatchUntilTaskCompletes(async::task<T>&& task) {
48 std::atomic<bool> isDone =
false;
49 async::task<T> unblockTask = task.then(
50 async::inline_scheduler(),
51 [
this, &isDone](async::task<T>&& task) {
58 this->dispatchInternal(
true);
61 return std::move(unblockTask).get();
65 T dispatchUntilTaskCompletes(
const async::shared_task<T>& task) {
71 async::task<void> unblockTask = task.then(
72 async::inline_scheduler(),
73 [
this](
const async::shared_task<T>&) { this->unblock(); });
75 while (!task.ready()) {
76 this->dispatchInternal(
true);
82 ImmediateScheduler<QueuedScheduler> immediate{
this};
85 bool dispatchInternal(
bool blockIfNoTasks);
89 std::unique_ptr<Impl> _pImpl;
Classes that support asynchronous operations.