Files
bsb2/kernel/thread/idlethread.h
2025-12-15 13:20:58 +01:00

29 lines
792 B
C++

/*! \file
* \brief \ref IdleThread executed by the \ref Scheduler if no other \ref
* Thread is ready
*/
#pragma once
#include "../types.h"
#include "thread.h"
/*! \brief Thread that is executed when there is nothing to do for this core.
* \ingroup thread
*
* Using the IdleThread simplifies the idea of waiting and is an answer to the
* questions that arise once the ready queue is empty.
*
* \note Instance of this class should *never* be inserted into the scheduler's
* ready queue, as the IdleThread should only be executed if there is no
* proper work to do.
*/
class IdleThread : public Thread {
public:
explicit IdleThread() : Thread(true) {}
/*! \brief Wait for a thread to become ready and sleep in the meantime.
*
*/
void action() override;
};