[#BloombergLP-bdlmt-Throttle] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlmt.adoc[bdlmt]::Throttle :relfileprefix: ../../ :mrdocs: This `class` provides a mechanism that can be used by clients to regulate the frequency at which actions can be taken. The data members of `Throttle` are currently public to allow for compile‐time (aggregate) initialization of `Throttle` objects having static storage duration (for C++03 compilers that do not provide `constexpr`). == Synopsis Declared in `<bdlmt_throttle.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Throttle; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlmt/Throttle/clockType.adoc[`clockType`] | Return the system clock type with which this `Throttle` is configured to observe the passage of time. | xref:BloombergLP/bdlmt/Throttle/initialize-03.adoc[`initialize`] | `initialize` overloads | xref:BloombergLP/bdlmt/Throttle/maxSimultaneousActions.adoc[`maxSimultaneousActions`] | Return the maximum number of simultaneous actions for which this `Throttle` is configured to permit. | xref:BloombergLP/bdlmt/Throttle/nanosecondsPerAction.adoc[`nanosecondsPerAction`] | Return the time debt, in nanoseconds, that this `Throttle` is configured to incur for each action permitted. | xref:BloombergLP/bdlmt/Throttle/nextPermit.adoc[`nextPermit`] | Load into the specified `result` the earliest _absolute_ _time_ (according to system clock configured at initialization) when the specified `numActions` will next be permitted. Return 0 on success, and a non‐zero value (with no effect on `result`) if this throttle is configured such that `numActions` will never be permitted (i.e., return an error if `numActions > maxSimultaneousActions`) or if `numActions <= 0`. The returned `result` is an offset from the epoch of the system clock for which this throttle is configured. The behavior is undefined unless this throttle has been initialized (either by calling `initialize` or using a `BDLMT_THROTTLE_INIT*` macro). Note that `result` may be in the past, and this function does _not_ obtain the current time from the system clock. | xref:BloombergLP/bdlmt/Throttle/requestPermission-0da.adoc[`requestPermission`] | `requestPermission` overloads | xref:BloombergLP/bdlmt/Throttle/requestPermissionIfValid-01.adoc[`requestPermissionIfValid`] | `requestPermissionIfValid` overloads |=== == Data Members [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlmt/Throttle/d_clockType.adoc[`d_clockType`] | Clock type (monotonic or realtime) used by this throttle. | xref:BloombergLP/bdlmt/Throttle/d_maxSimultaneousActions.adoc[`d_maxSimultaneousActions`] | Total bucket capacity expressed in actions. | xref:BloombergLP/bdlmt/Throttle/d_nanosecondsPerAction.adoc[`d_nanosecondsPerAction`] | Nanoseconds consumed by each sustained action. | xref:BloombergLP/bdlmt/Throttle/d_nanosecondsPerTotalReset.adoc[`d_nanosecondsPerTotalReset`] | Total bucket capacity expressed in nanoseconds. | xref:BloombergLP/bdlmt/Throttle/d_prevLeakTime.adoc[`d_prevLeakTime`] | Effective time of the previous leak operation. |=== == Static Data Members [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlmt/Throttle/k_TEN_YEARS_NANOSECONDS.adoc[`k_TEN_YEARS_NANOSECONDS`] | Ten years expressed in nanoseconds. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdlmt/Throttle_InitHelper.adoc[BloombergLP::bdlmt::Throttle_InitHelper]` | [*PRIVATE*]This component private meta‐function is used to implement the initialization macros. This type provides the following: * Ensures arguments are evaluated at compile time (which won't be the case for floating point arguments) * Enables compile time checks with BSLMF_ASSERT * Handles special cases if 0 is passed for `t_MAX_SIMULTANEOUS_ACTIONS` or `t_NANOSECONDS_PER_ACTION` |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#