24 #include <olp/core/client/ApiResponse.h>
25 #include <olp/core/client/CancellationContext.h>
33 enum Priority : uint32_t { LOW = 100, NORMAL = 500, HIGH = 1000 };
71 EnqueueTask(std::move(func), priority);
91 template <
class Function,
typename std::enable_if<!std::is_convertible<
92 decltype(std::declval<Function>()),
93 CallFuncType>::value>::type* =
nullptr>
96 auto task = [func, context]() {
101 EnqueueTask(std::move(task));
137 EnqueueTask(std::forward<CallFuncType>(func));
148 inline CORE_API
void ExecuteOrSchedule(
149 const std::shared_ptr<TaskScheduler>& scheduler,
158 scheduler->ScheduleTask(std::move(func));
Contains utilities used to work around compiler warnings.
#define OLP_SDK_CORE_UNUSED(...)
Arbitrarily marks many variables as unused to avoid compiler warnings.
Definition: WarningWorkarounds.h:28
A wrapper that manages the cancellation state of an asynchronous operation in a thread-safe way.
Definition: CancellationContext.h:40
bool IsCancelled() const
Checks whether this context is cancelled.
Definition: CancellationContext.inl:66
An abstract interface that is used as a base for the custom thread scheduling strategy.
Definition: TaskScheduler.h:45
virtual void EnqueueTask(CallFuncType &&)=0
The abstract enqueue task interface that is implemented by the subclass.
client::CancellationContext ScheduleTask(Function &&func)
Schedules the asynchronous cancellable task.
Definition: TaskScheduler.h:94
virtual void EnqueueTask(CallFuncType &&func, uint32_t priority)
The enqueue task with priority interface that is implemented by the subclass.
Definition: TaskScheduler.h:135
std::function< void()> CallFuncType
An alias for the abstract interface input.
Definition: TaskScheduler.h:48
void ScheduleTask(CallFuncType &&func, uint32_t priority)
Schedules the asynchronous task.
Definition: TaskScheduler.h:70
void ScheduleTask(CallFuncType &&func)
Schedules the asynchronous task.
Definition: TaskScheduler.h:60
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24