ocarina/include/core/idle.h

30 lines
978 B
C
Raw Normal View History

/**
* Copyright 2013 (c) Anna Schumaker.
*
* The idle queue is used to schedule function calls to run at a
* later time. It is expected that a higher layer can determine
* when the application is idle and call idle_run_task() accordingly.
*
* The idle layer keeps a count of the number of tasks added to the queue
* since the last time the queue was empty. Whenever a task is scheduled,
* the "queued" count is incremented by 1. When tasks are run, the "serviced"
* count is incremented by 1. These counters are reset to 0 once the queue
* is empty.
*/
#ifndef OCARINA_CORE_IDLE_H
#define OCARINA_CORE_IDLE_H
/* Called to schedule a function to run later. */
void idle_schedule(void (*)(void *), void *);
/*
* Called to run the next task on the idle queue.
* Returns true if there are more tasks to run.
*/
bool idle_run_task();
/* Called to find the percentage of idle tasks that have been run. */
float idle_progress();
#endif /* OCARINA_CORE_IDLE_H */