Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::RateLimiter Class Reference

Rate limiter. More...

#include <rate_limiter.h>

Inheritance diagram for roc::core::RateLimiter:
Collaboration diagram for roc::core::RateLimiter:

Public Member Functions

 RateLimiter (nanoseconds_t period)
 Initialize rate limiter. More...
 
bool would_allow ()
 Check whether allow() would succeed. More...
 
bool allow ()
 Check whether an event is allowed to occur now, and if yes, mark it as occurred. More...
 

Detailed Description

Rate limiter.

Definition at line 22 of file rate_limiter.h.

Constructor & Destructor Documentation

◆ RateLimiter()

roc::core::RateLimiter::RateLimiter ( nanoseconds_t  period)
explicit

Initialize rate limiter.

Remarks
period is tick duration in nanoseconds.

Member Function Documentation

◆ allow()

bool roc::core::RateLimiter::allow ( )

Check whether an event is allowed to occur now, and if yes, mark it as occurred.

◆ would_allow()

bool roc::core::RateLimiter::would_allow ( )

Check whether allow() would succeed.


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