14#include <threadpoolapiset.h>
115 friend struct asio_query_fn::impl;
116 friend struct asio::execution::detail::context_t<0>;
117 friend struct asio::execution::detail::mapping_t<0>;
118 friend struct asio::execution::detail::blocking_t<0>;
119 friend struct asio::execution::detail::relationship_t<0>;
120 friend struct asio::execution::detail::outstanding_work_t<0>;
121 friend struct asio::execution::detail::bulk_guarantee_t<0>;
122 friend struct asio::execution::detail::occupancy_t<0>;
148 static std::allocator<void> allocator;
154 static std::allocator<void> allocator;
159 friend struct asio_require_fn::impl;
160 friend struct asio_prefer_fn::impl;
187 friend struct asio_execution_execute_fn::impl;
192 mExecutionContext->
schedule(std::forward<Function>(f), mBlockingProperty, mPriority);
#define CE_ASSERT(...)
Definition Macros.hpp:323
An object that manages the execution of tasks serially or concurrently on your app's main thread or o...
Definition DispatchQueue.hpp:36
An executor object that dispatches calls to the CoreFoundation CFRunLoop.
Definition Win32ThreadPool.hpp:63
Win32ThreadPool * mExecutionContext
The execution context that the executor will use.
Definition Win32ThreadPool.hpp:68
static constexpr ExecutorMapping query(ExecutorMapping) noexcept
Query the current value of the mapping property.
Definition Win32ThreadPool.hpp:128
Executor(Win32ThreadPool *const executionContext, const ExecutorBlocking blockingProperty=ExecutorBlocking::never, const ExecutorPriority priority=ExecutorPriority::Normal)
Creates a new Executor instance.
Definition Win32ThreadPool.hpp:81
static constexpr ExecutorBulkGuarantee query(ExecutorBulkGuarantee) noexcept
Query the current value of the bulk_guarantee property.
Definition Win32ThreadPool.hpp:140
void execute(ASIO_MOVE_ARG(Function) f) const
Execution function.
Definition Win32ThreadPool.hpp:190
static constexpr ExecutorOutstandingWork query(ExecutorOutstandingWork) noexcept
Query the current value of the outstanding_work property.
Definition Win32ThreadPool.hpp:137
std::size_t query(ExecutorOccupancy) const noexcept
Query the occupancy (recommended number of work items) for the system context.
Definition Win32ThreadPool.hpp:144
std::allocator< void > query(ExecutorAllocator< OtherAllocator >) const noexcept
Query the current value of the allocator property.
Definition Win32ThreadPool.hpp:147
ExecutorBlocking query(ExecutorBlocking) const noexcept
Query the current value of the blocking property.
Definition Win32ThreadPool.hpp:131
std::allocator< void > query(ExecutorAllocator< void >) const noexcept
Query the current value of the allocator property.
Definition Win32ThreadPool.hpp:153
Executor(const Executor &)=default
Executor & operator=(Executor &&)=default
Win32ThreadPool & query(ExecutorExecutionContext) const noexcept
Query the current value of the context property.
Definition Win32ThreadPool.hpp:125
Executor & operator=(const Executor &)=default
void on_work_finished() const noexcept
Inform the executor that some work is no longer outstanding.
Definition Win32ThreadPool.hpp:102
friend bool operator!=(const Executor &, const Executor &) noexcept
Compare two executors for inequality.
Definition Win32ThreadPool.hpp:112
friend bool operator==(const Executor &, const Executor &) noexcept
Compare two executors for equality.
Definition Win32ThreadPool.hpp:109
Executor(Executor &&)=default
Executor require(const ExecutorPriority newPriority) const
Obtain an executor with the given priority property.
Definition Win32ThreadPool.hpp:184
Executor require(const ExecutorBlocking blocking) const
Obtain an executor with the given blocking property.
Definition Win32ThreadPool.hpp:172
Win32ThreadPool & context() const noexcept
Obtain the underlying execution context.
Definition Win32ThreadPool.hpp:93
void on_work_started() const noexcept
Inform the executor that it has some outstanding work to do.
Definition Win32ThreadPool.hpp:96
static constexpr ExecutorRelationship query(ExecutorRelationship) noexcept
Query the current value of the relationship property.
Definition Win32ThreadPool.hpp:134
Definition Win32ThreadPool.hpp:18
PTP_POOL mThreadPool
Definition Win32ThreadPool.hpp:21
AnyExecutor getExecutor() noexcept final
Returns an executor that run execute scheduled commands on the context.
Definition Win32ThreadPool.hpp:196
TP_CALLBACK_ENVIRON mCallbackEnvironments[3]
Definition Win32ThreadPool.hpp:20
void suspend() final
Suspends the invocation of function objects on a queue.
UPtr< DispatchQueue > createSubQueue(DispatchQueueType type, StringView name="") final
Resumes the invocation of block objects on a queue.
void schedule(UniqueFunction< void()> function, ExecutorBlocking blockingProperty, ExecutorPriority priority)
Schedules a new function to be run in the run loop.
void resume() final
Resumes the invocation of block objects on a queue.
Win32ThreadPool(DispatchQueueType type)
~Win32ThreadPool() noexcept final
void onWorkStarted() noexcept
Inform the executor that it has some outstanding work to do.
void onWorkFinished() noexcept
Inform the executor that some work is no longer outstanding.
PTP_CALLBACK_ENVIRON getCallbackEnvironment(ExecutorPriority priority) noexcept
Determines the callback environment that better fits the given priority execution requirement.
Definition Application.hpp:19
std::unique_ptr< T, Deleter > UPtr
UPtr is a smart pointer that owns and manages another object through a pointer and disposes of that o...
Definition SmartPtr.hpp:28
asio::execution::context_t ExecutorExecutionContext
Definition ExecutionContext.hpp:208
asio::execution::relationship_t ExecutorRelationship
Definition ExecutionContext.hpp:215
asio::execution::mapping_t ExecutorMapping
Definition ExecutionContext.hpp:211
asio::execution::bulk_guarantee_t ExecutorBulkGuarantee
Definition ExecutionContext.hpp:214
asio::execution::occupancy_t ExecutorOccupancy
Definition ExecutionContext.hpp:212
FunctionBase< true, true, fu2::capacity_default, true, false, Signatures... > Function
An owning copyable function wrapper for arbitrary callable types.
Definition Function.hpp:54
DispatchQueueType
Specifies the type of the queue.
Definition DispatchQueue.hpp:17
asio::execution::allocator_t< T > ExecutorAllocator
Definition ExecutionContext.hpp:216
asio::execution::blocking_t ExecutorBlocking
Definition ExecutionContext.hpp:210
asio::execution::outstanding_work_t ExecutorOutstandingWork
Definition ExecutionContext.hpp:213
ASIO_MOVE_ARG(CompletionToken) token)
Definition IdleService.hpp:42
FunctionBase< true, false, fu2::capacity_default, true, false, Signatures... > UniqueFunction
An owning non copyable function wrapper for arbitrary callable types.
Definition Function.hpp:59
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Determines the priority to which an executor should schedule its tasks.
Definition ExecutionContext.hpp:220
static const ExecutorPriority Normal
The default value for regular tasks.
Definition ExecutionContext.hpp:250