15#include <CoreFoundation/CoreFoundation.h>
17#include <asio/execution.hpp>
75 friend struct asio::execution::detail::context_t<0>;
76 friend struct asio::execution::detail::mapping_t<0>;
77 friend struct asio::execution::detail::blocking_t<0>;
78 friend struct asio::execution::detail::relationship_t<0>;
79 friend struct asio::execution::detail::outstanding_work_t<0>;
80 friend struct asio::execution::detail::bulk_guarantee_t<0>;
81 friend struct asio::execution::detail::occupancy_t<0>;
107 static std::allocator<void> allocator;
113 static std::allocator<void> allocator;
#define CE_ASSERT(...)
Definition Macros.hpp:323
An executor object that dispatches calls to the CoreFoundation CFRunLoop.
Definition AppleRunLoop.hpp:26
ExecutorBlocking query(ExecutorBlocking) const noexcept
Query the current value of the blocking property.
Definition AppleRunLoop.hpp:90
ExecutorBlocking mBlockingProperty
A property that customizes the blocking behavior of the executor.
Definition AppleRunLoop.hpp:34
AppleRunLoop & context() const noexcept
Obtain the underlying execution context.
Definition AppleRunLoop.hpp:52
friend struct asio_prefer_fn::impl
Definition AppleRunLoop.hpp:119
Executor(AppleRunLoop *const executionContext, ExecutorBlocking blockingProperty=ExecutorBlocking::never)
Creates a new Executor instance.
Definition AppleRunLoop.hpp:41
static constexpr ExecutorMapping query(ExecutorMapping) noexcept
Query the current value of the mapping property.
Definition AppleRunLoop.hpp:87
static constexpr ExecutorOutstandingWork query(ExecutorOutstandingWork) noexcept
Query the current value of the outstanding_work property.
Definition AppleRunLoop.hpp:96
void on_work_finished() const noexcept
Inform the executor that some work is no longer outstanding.
Definition AppleRunLoop.hpp:61
AppleRunLoop & query(ExecutorExecutionContext) const noexcept
Query the current value of the context property.
Definition AppleRunLoop.hpp:84
Executor & operator=(Executor &&)=default
Executor(Executor &&)=default
static constexpr ExecutorRelationship query(ExecutorRelationship) noexcept
Query the current value of the relationship property.
Definition AppleRunLoop.hpp:93
std::allocator< void > query(ExecutorAllocator< void >) const noexcept
Query the current value of the allocator property.
Definition AppleRunLoop.hpp:112
friend struct asio_execution_execute_fn::impl
Definition AppleRunLoop.hpp:134
static constexpr ExecutorBulkGuarantee query(ExecutorBulkGuarantee) noexcept
Query the current value of the bulk_guarantee property.
Definition AppleRunLoop.hpp:99
Executor require(ExecutorBlocking blocking) const
Obtain an executor with the given blocking property.
Definition AppleRunLoop.hpp:131
friend struct asio_require_fn::impl
Definition AppleRunLoop.hpp:118
std::allocator< void > query(ExecutorAllocator< OtherAllocator >) const noexcept
Query the current value of the allocator property.
Definition AppleRunLoop.hpp:106
AppleRunLoop * mExecutionContext
The execution context that the executor will use.
Definition AppleRunLoop.hpp:31
friend bool operator!=(const Executor &, const Executor &) noexcept
Compare two executors for inequality.
Definition AppleRunLoop.hpp:71
friend bool operator==(const Executor &, const Executor &) noexcept
Compare two executors for equality.
Definition AppleRunLoop.hpp:68
std::size_t query(ExecutorOccupancy) const noexcept
Query the occupancy (recommended number of work items) for the system context.
Definition AppleRunLoop.hpp:103
Executor & operator=(const Executor &)=default
Executor(const Executor &)=default
void execute(ASIO_MOVE_ARG(Function) f) const
Execution function.
Definition AppleRunLoop.hpp:137
friend struct asio_query_fn::impl
Definition AppleRunLoop.hpp:74
void on_work_started() const noexcept
Inform the executor that it has some outstanding work to do.
Definition AppleRunLoop.hpp:55
Abstracts a CoreFoundation CFRunLoop as an ASIO execution context.
Definition AppleRunLoop.hpp:22
void run() final
Starts running the run loop.
void onWorkStarted() noexcept
Inform the executor that it has some outstanding work to do.
CFRunLoopRef getRunLoop() const noexcept
The CoreFoundation CFRunLoop instance to execute commands on.
Definition AppleRunLoop.hpp:174
Scope mScope
A scope for the run loop object.
Definition AppleRunLoop.hpp:151
void schedule(UniqueFunction< void()> function, ExecutorBlocking blockingProperty)
Schedules a new function to be run in the run loop.
AppleRunLoop() noexcept
Creates a new Apple run loop instance for the current thread.
CFRunLoopRef mRunLoop
The CoreFoundation CFRunLoop instance to execute commands on.
Definition AppleRunLoop.hpp:145
executor_type get_executor() noexcept
Returns an executor that run execute scheduled commands on the context.
Definition AppleRunLoop.hpp:192
CFRunLoopObserverRef mRunLoopObserver
An observer that will receive events during the run loop execution.
Definition AppleRunLoop.hpp:148
void onWorkFinished() noexcept
Inform the executor that some work is no longer outstanding.
void stop() final
Stops the execution of the run loop.
AnyExecutor getExecutor() noexcept final
Returns an executor that run execute scheduled commands on the context.
Scope object that sets the current execution context as current.
Definition ExecutionContext.hpp:180
An ASIO execution context that wraps the operating system run loop.
Definition RunLoop.hpp:17
Definition Application.hpp:19
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
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