pub struct Scheduler { /* private fields */ }
Expand description

| Simple class for background tasks that | should be run periodically or once “after | a while” | | Usage: | | ———– | @code | | CScheduler* s = new CScheduler(); | s->scheduleFromNow(doSomething, std::chrono::milliseconds{11}); // Assuming a: c_void doSomething() { } | s->scheduleFromNow([=] { this->func(argument); }, std::chrono::milliseconds{3}); | std::thread* t = new std::thread(& { s->serviceQueue(); }); |
| … then at program shutdown, make sure to call stop() to clean up the thread(s) running serviceQueue: | s->stop(); | t->join(); | delete t; | delete s; // Must be done after thread is interrupted/joined. |

Implementations§

| Call f once after the delta has passed |

| Tell any threads running serviceQueue | to stop as soon as the current task is | done |

| Tell any threads running serviceQueue | to stop when there is no work left to be | done |

| Services the queue ‘forever’. Should | be run in a thread. |

| Call func at/after time t |

| Mock the scheduler to fast forward in | time. | | Iterates through items on taskQueue | and reschedules them to be delta_seconds | sooner. |

| Repeat f until the scheduler is stopped. | First run is after delta has passed once. | | The timing is not exact: Every time f | is finished, it is rescheduled to run | again after delta. If you need more accurate | scheduling, don’t use this method. |

| Returns number of tasks waiting to be | serviced, and first and last task times |

| Returns true if there are threads actively | running in serviceQueue() |

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Performs the conversion. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Convert type of a const pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.