cmake-template
Loading...
Searching...
No Matches
IScheduler Class Referenceabstract

#include <scheduler.hpp>

Inheritance diagram for IScheduler:
[legend]

Public Member Functions

virtual ~IScheduler ()=default
 
virtual void schedule (std::function< void()> task)=0
 Schedules a task to be executed by the scheduler. More...
 
virtual void wait ()=0
 Waits for all scheduled tasks to complete. More...
 
virtual void shutdown ()=0
 Shuts down the scheduler and stops all scheduled tasks. More...
 

Constructor & Destructor Documentation

◆ ~IScheduler()

virtual IScheduler::~IScheduler ( )
virtualdefault

Member Function Documentation

◆ schedule()

virtual void IScheduler::schedule ( std::function< void()>  task)
pure virtual

Schedules a task to be executed by the scheduler.

This method allows you to add a new task to the scheduler's queue of tasks to be executed. The provided task will be added to the queue, and the scheduler will manage the execution of tasks according to its scheduling policy. The task can be any callable object, such as a lambda, function pointer, or std::function

Parameters
taskThe task to be executed by the scheduler. This can be any callable object, such as a lambda, function pointer, or std::function

Implemented in ThreadPool.

◆ shutdown()

virtual void IScheduler::shutdown ( )
pure virtual

Shuts down the scheduler and stops all scheduled tasks.

This method signals the scheduler to stop accepting new tasks and to shut down. It will wait for all currently scheduled tasks to complete before shutting down the scheduler. After calling this method, the scheduler will no longer accept new tasks, and all resources associated with the scheduler will be cleaned up. This is important for ensuring that all tasks are properly completed and that the scheduler is gracefully shut down without leaving any tasks hanging or resources leaking

Implemented in ThreadPool.

◆ wait()

virtual void IScheduler::wait ( )
pure virtual

Waits for all scheduled tasks to complete.

This method blocks the calling thread until all tasks that have been scheduled for execution have completed. It will wait for all tasks in the scheduler's queue to be processed and finished before returning. This is useful for ensuring that all tasks have been completed before proceeding with further operations or shutting down the scheduler

Implemented in ThreadPool.


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