13#include "../asrtl/status.h"
15#include <ecor/ecor.hpp>
22 void* allocate( std::size_t n, std::size_t ) {
return malloc( n ); }
24 void deallocate(
void* p, std::size_t, std::size_t )
noexcept { std::free( p ); }
32 : _memory_resource( mem_res )
36 void tick() { _core.run_once(); }
38 auto& query( ecor::get_memory_resource_t ) {
return _memory_resource; }
40 auto& query( ecor::get_task_core_t ) {
return _core; }
42 void reschedule( ecor::schedulable& s ) { _core.reschedule( s ); }
45 ecor::task_memory_resource _memory_resource;
46 ecor::task_core _core;
49using status = asrt_status;
60 using extra_error_signatures = ecor::
61 completion_signatures< ecor::set_error_t( status ), ecor::set_error_t(
test_fail_t ) >;
62 using trace_type = ecor::task_default_trace;
67template <
typename T >
68using task = ecor::task< T, asrt::task_cfg >;
75 using sender_concept = ecor::sender_t;
76 using completion_signatures =
77 ecor::completion_signatures< ecor::set_value_t(), ecor::set_error_t( status ) >;
86 template < ecor::receiver R >
94 if ( s == ASRT_SUCCESS )
101 template < ecor::receiver R >
102 auto connect( R&& r ) &&
noexcept
104 return op< R >{ status, (R&&) r };
107 constexpr operator asrt_status()
const {
return status; }
108 constexpr bool operator==( asrt_status st )
const {
return status == st; }
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: callback.hpp:17
ecor::task< T, asrt::task_cfg > task
Coroutine task type used throughout asrt's C++ layer.
Definition: task.hpp:68
Sender that completes with success if the contained status is ASRT_SUCCESS, and with test_fail otherw...
Definition: task.hpp:74
Error signatures and trace policy used by all asrt tasks.
Definition: task.hpp:59
Event-loop context that owns a coroutine task scheduler.
Definition: task.hpp:30