fiber
Loading...
Searching...
No Matches
fiber::SoftPeriodicTask Class Reference

#include <PeriodicTask.hpp>

Inheritance diagram for fiber::SoftPeriodicTask:
fiber::Task< frame_size > fiber::TaskBase

Public Attributes

TimePoint _prev_execution
 
Duration _period
 
Duration _deadline
 
Duration _offset = 0
 
- Public Attributes inherited from fiber::TaskBase
std::string_view _task_name = ""
 
fiber::StackAllocatorExtern_frame_allocator
 
Coroutine< fiber::Exit_main_coroutine
 
CoroutineNode_leaf_coroutine = nullptr
 
bool(* _leaf_awaitable_ready_func )(const void *_leaf_awaitable_obj) = nullptr
 
const void * _leaf_awaitable_obj = nullptr
 
CoSignal _signal
 
uint32_t _priority = 0
 
Schedule _schedule
 
TimePoint _execution_start
 
uint16_t _id = 0
 
bool _instant_resume = false
 
bool _immediatelly_ready = false
 

Additional Inherited Members

- Public Member Functions inherited from fiber::Task< frame_size >
template<class F, class... Args>
requires std::invocable<F, Args...> && std::same_as<std::invoke_result_t<F, Args...>, Coroutine<fiber::Exit>>
constexpr Task (std::string_view task_name, uint16_t priority, F &&function, Args &&... args)
 constructor to create a priority-based task that starts immediatelly
 
template<class F, class... Args>
requires std::invocable<F, Args...> && std::same_as<std::invoke_result_t<F, Args...>, Coroutine<fiber::Exit>>
constexpr Task (std::string_view task_name, uint16_t priority, TimePoint ready, F &&function, Args &&... args)
 constructor to create a priority-based task
 
template<class F, class... Args>
requires std::invocable<F, Args...> && std::same_as<std::invoke_result_t<F, Args...>, Coroutine<fiber::Exit>>
constexpr Task (std::string_view task_name, TimePoint ready, TimePoint deadline, F &&function, Args &&... args)
 constructor to create a real-time deadline-based task
 
template<class F, class... Args>
requires std::invocable<F, Args...> && std::same_as<std::invoke_result_t<F, Args...>, Coroutine<fiber::Exit>>
constexpr Task (std::string_view task_name, TimePoint ready, Duration deadline, F &&function, Args &&... args)
 constructor to create a real-time deadline-based task
 
- Public Member Functions inherited from fiber::TaskBase
constexpr TaskBase ()=default
 
constexpr TaskBase (const TaskBase &)=delete
 
constexpr TaskBaseoperator= (const TaskBase &)=delete
 
constexpr TaskBase (TaskBase &&other) noexcept
 
TaskBaseoperator= (TaskBase &&other) noexcept
 
template<class F, class... Args>
requires std::invocable<F, Args...> && std::same_as<std::invoke_result_t<F, Args...>, Coroutine<fiber::Exit>>
constexpr TaskBase (std::string_view task_name, fiber::StackAllocatorExtern *frame_allocator, F &&function, Args &&... args)
 constructor to create a priority-based task with the lowest priority
 
template<class F, class... Args>
requires std::invocable<F, Args...> && std::same_as<std::invoke_result_t<F, Args...>, Coroutine<fiber::Exit>>
constexpr TaskBase (std::string_view task_name, uint16_t priority, fiber::StackAllocatorExtern *frame_allocator, F &&function, Args &&... args)
 constructor to create a priority-based task that starts immediatelly
 
template<class F, class... Args>
requires std::invocable<F, Args...> && std::same_as<std::invoke_result_t<F, Args...>, Coroutine<fiber::Exit>>
constexpr TaskBase (std::string_view task_name, TimePoint ready, fiber::StackAllocatorExtern *frame_allocator, F &&function, Args &&... args)
 constructor to create a priority-based task that starts at a certain time point in the future
 
template<class F, class... Args>
requires std::invocable<F, Args...> && std::same_as<std::invoke_result_t<F, Args...>, Coroutine<fiber::Exit>>
constexpr TaskBase (std::string_view task_name, TimePoint ready, TimePoint deadline, fiber::StackAllocatorExtern *frame_allocator, F &&function, Args &&... args)
 constructor to create a real-time deadline-based task
 
template<class F, class... Args>
requires std::invocable<F, Args...> && std::same_as<std::invoke_result_t<F, Args...>, Coroutine<fiber::Exit>>
constexpr TaskBase (std::string_view task_name, TimePoint ready, Duration deadline, fiber::StackAllocatorExtern *frame_allocator, F &&function, Args &&... args)
 constructor to create a real-time deadline-based task
 
virtual ~TaskBase ()
 
virtual bool missed_deadline (fiber::Duration d)
 Overrideable: Gets called if the deadline has been missed and decides wether the task should still execute or not.
 
virtual Schedule next_schedule (Schedule previous_schedule, ExecutionTime previous_execution)
 Overrideable: Gets called after a co_await NextCycle; to calculate the schedule of the next cycle.
 
constexpr unsigned int id () const
 returns the assigned id of the task.
 
constexpr bool is_deadline_based () const
 
constexpr bool is_priority_based () const
 
constexpr std::string_view name () const
 returns the name of the task
 
constexpr std::size_t max_frame_size () const
 returns the maximal allocatable size of the frame (stack allocator)
 
constexpr std::size_t allocated_frame_size () const
 returns the allocated size of the frame (stack allocator)
 
constexpr std::size_t max_allocated_frame_size () const
 returns the maximal allocated size in the frame since construction (stack allocator)
 
constexpr void signal (const CoSignal &signal)
 sets a coroutine control signal.
 
constexpr const CoSignal get_signal ()
 reads and clears the signal
 
constexpr void destroy ()
 destroys all contained coroutines
 
constexpr void register_leaf (CoroutineNode *leaf) noexcept
 Registers the leaf nested coroutine that serves as the resume point after suspensions.
 
template<class T>
constexpr void register_leaf (const T *obj, bool(*func)(const T *obj)) noexcept
 Registers a leaf awaitable that will be waited on before resuming its parents coroutine.
 
void resume ()
 resumes the task/coroutine
 
bool is_resumable () const
 returns true if the awaitable that this task is waiting on is ready and .resume() can be called again
 
constexpr bool is_awaiting () const
 returns true if the awaitable that this task is waiting on is still waiting for completion - aka. this task is not resumable
 
constexpr bool is_done () const
 returns true if the main/root coroutine is done - thus the task is done
 
constexpr bool await_ready () const noexcept
 same as is_done() but for interoperability with co_await
 
constexpr Exit await_resume ()
 interoperability with co_await
 
constexpr Exit exit_status ()
 
void handle_exception (std::exception_ptr except_ptr)
 exception handler - will be called if an un-catched exception in a coroutine arises
 
TimePoint ready_time () const
 
TimePoint deadline () const
 
uint32_t priority () const
 
bool immediatelly_ready () const
 
- Static Public Attributes inherited from fiber::TaskBase
static constexpr uint32_t _deadline_priority = std::numeric_limits<uint32_t>::max()
 

Member Data Documentation

◆ _deadline

Duration fiber::SoftPeriodicTask::_deadline

◆ _offset

Duration fiber::SoftPeriodicTask::_offset = 0

◆ _period

Duration fiber::SoftPeriodicTask::_period

◆ _prev_execution

TimePoint fiber::SoftPeriodicTask::_prev_execution

The documentation for this class was generated from the following file: