29#ifndef ETL_SCHEDULER_INCLUDED
30#define ETL_SCHEDULER_INCLUDED
108 for (
size_t index = 0
UL; index < task_list.size(); ++index)
137 for (
size_t index = 0
UL; index < task_list.size(); ++index)
167 while (index < task_list.size())
202 for (
size_t index = 0
UL; index < task_list.size(); ++index)
235 virtual void start() = 0;
270 return scheduler_running;
278 scheduler_exit =
true;
289 if (!task_list.
full())
307 template <
typename TSize>
323 : scheduler_running(false),
324 scheduler_exit(false),
325 p_idle_callback(ETL_NULLPTR),
326 p_watchdog_callback(ETL_NULLPTR),
331 bool scheduler_running;
341 struct compare_priority
350 task_list_t& task_list;
356 template <
typename TSchedulerPolicy,
size_t MAX_TASKS_>
378 scheduler_running =
true;
380 while (!scheduler_exit)
382 if (scheduler_running)
384 bool idle = TSchedulerPolicy::schedule_tasks(task_list);
386 if (p_watchdog_callback)
388 (*p_watchdog_callback)();
391 if (
idle && p_idle_callback)
393 (*p_idle_callback)();
402 task_list_t task_list;
Scheduler base.
Definition scheduler.h:229
void add_task_list(etl::task **p_tasks, TSize size)
Definition scheduler.h:308
ischeduler(etl::ivector< etl::task * > &task_list_)
Constructor.
Definition scheduler.h:322
void set_watchdog_callback(etl::ifunction< void > &callback)
Set the watchdog callback.
Definition scheduler.h:252
void exit_scheduler()
Force the scheduler to exit.
Definition scheduler.h:276
void set_scheduler_running(bool scheduler_running_)
Set the running state for the scheduler.
Definition scheduler.h:260
void add_task(etl::task &task)
Definition scheduler.h:285
void set_idle_callback(etl::ifunction< void > &callback)
Set the idle callback.
Definition scheduler.h:244
bool scheduler_is_running() const
Get the running state for the scheduler.
Definition scheduler.h:268
Base exception class for scheduler.
Definition scheduler.h:49
'No tasks' exception.
Definition scheduler.h:62
'Null tasks' exception.
Definition scheduler.h:75
'Too many tasks' exception.
Definition scheduler.h:88
Scheduler.
Definition scheduler.h:358
void start()
Start the scheduler.
Definition scheduler.h:374
Task.
Definition task.h:59
virtual void on_task_added()
Called when the task has been added to the scheduler.
Definition task.h:92
virtual uint32_t task_request_work() const =0
etl::task_priority_t get_task_priority() const
Definition task.h:117
virtual void task_process_work()=0
Called to get the task to do work.
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
Definition exception.h:47
iterator begin()
Definition vector.h:100
iterator end()
Definition vector.h:118
bool full() const
Definition vector.h:996
iterator insert(const_iterator position, const_reference value)
Definition vector.h:579
bitset_ext
Definition absolute.h:38
ETL_DEPRECATED typedef scheduler_policy_sequential_multiple scheduler_policy_sequencial_multiple
Typedef for backwards compatibility with miss-spelt struct name.
Definition scheduler.h:153
ETL_CONSTEXPR TContainer::size_type size(const TContainer &container)
Definition iterator.h:1187
pair holds two objects of arbitrary type
Definition utility.h:164
Definition scheduler.h:161
Definition scheduler.h:194
Definition scheduler.h:132
Definition scheduler.h:103