ecor
Loading...
Searching...
No Matches
ecor::task_core Struct Reference

Maintains a list of ready tasks that can be resumed. More...

#include <ecor.hpp>

Public Member Functions

void reschedule (_schedulable &op) noexcept
 Reschedule a task by adding it's promise to the list of ready tasks. More...
 
void run_n (std::size_t n)
 Run up to n ready tasks. More...
 
bool run_once ()
 Run a single ready task if there is one. More...
 

Detailed Description

Maintains a list of ready tasks that can be resumed.

Used by the library to re-schedule woken-up tasks. Has to be periodically polled by the user to run the ready tasks, either by calling run_once() to run a single task, or run_n() to run multiple tasks.

Member Function Documentation

◆ reschedule()

void ecor::task_core::reschedule ( _schedulable &  op)
inlinenoexcept

Reschedule a task by adding it's promise to the list of ready tasks.

The task will be resumed the next time run_once() or run_n() is called.

◆ run_n()

void ecor::task_core::run_n ( std::size_t  n)
inline

Run up to n ready tasks.

This repeatedly calls run_once() until either n tasks have been run or there are no more ready tasks to run.

◆ run_once()

bool ecor::task_core::run_once ( )
inline

Run a single ready task if there is one.

This removes the task from the list of ready tasks and resumes it. Returns true if a task was run, or false if there were no ready tasks to run.


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