[#CScheduler]
= CScheduler
:mrdocs:

Schedules deferred and recurring background tasks&period;

== Synopsis

Declared in `&lt;scheduler&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class CScheduler;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:CScheduler/Function.adoc[`Function`] 
| Callable type for scheduled tasks&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CScheduler/2constructor.adoc[`CScheduler`]         [.small]#[constructor]#
| Constructs an idle scheduler with an empty task queue&period;
| xref:CScheduler/2destructor.adoc[`&#126;CScheduler`] [.small]#[destructor]#
| Destroys the scheduler&semi; the service thread must already be stopped&period;
| xref:CScheduler/AreThreadsServicingQueue.adoc[`AreThreadsServicingQueue`] 
| Returns true if there are threads actively running in serviceQueue()
| xref:CScheduler/MockForward.adoc[`MockForward`] 
| Mock the scheduler to fast forward in time&period; Iterates through items on taskQueue and reschedules them to be delta&lowbar;seconds sooner&period;
| xref:CScheduler/StopWhenDrained.adoc[`StopWhenDrained`] 
| Tell any threads running serviceQueue to stop when there is no work left to be done
| xref:CScheduler/getQueueInfo.adoc[`getQueueInfo`] 
| Returns number of tasks waiting to be serviced, and first and last task times
| xref:CScheduler/schedule.adoc[`schedule`] 
| Call func at&sol;after time t
| xref:CScheduler/scheduleEvery.adoc[`scheduleEvery`] 
| Repeat f until the scheduler is stopped&period; First run is after delta has passed once&period;
| xref:CScheduler/scheduleFromNow.adoc[`scheduleFromNow`] 
| Call f once after the delta has passed
| xref:CScheduler/serviceQueue.adoc[`serviceQueue`] 
| scheduler Services the queue &apos;forever&apos;&period; Should be run in a thread&period;
| xref:CScheduler/stop.adoc[`stop`] 
| Tell any threads running serviceQueue to stop as soon as the current task is done
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:CScheduler/m_service_thread.adoc[`m&lowbar;service&lowbar;thread`] 
| Thread running serviceQueue(), if the scheduler was started on its own thread&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
