libDwm-0.9.45
Dwm::Pacer Class Reference

This class permits throttling of functions to a max number of repetitions per second. More...

#include <DwmPacer.hh>

Public Member Functions

 Pacer (uint32_t rate)
 Construct with the given rate (reps per second).
 
uint32_t Rate () const
 Returns the rate (reps per second).
 
uint32_t Rate (uint32_t rate)
 Sets the rate (reps per second).
 
void Pace ()
 This should be called between each call you wish to throttle.
 

Detailed Description

This class permits throttling of functions to a max number of repetitions per second.

Instead of bogusly calling one of the sleep functions between each call (which will result in more throttling than desired), it will always sleep at least one clock tick when it sleeps.

Member Function Documentation

◆ Pace()

void Dwm::Pacer::Pace ( )

This should be called between each call you wish to throttle.

If the current time is less than or equal to the time in which the next function call is supposed to be made, it will sleep the difference.


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