[#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&period; The data members of `Throttle` are currently public to allow for compile&hyphen;time (aggregate) initialization of `Throttle` objects having static storage duration (for C&plus;&plus;03 compilers that do not provide `constexpr`)&period;

== Synopsis

Declared in `&lt;bdlmt&lowbar;throttle&period;h&gt;`

[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&period;
| 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&period;
| xref:BloombergLP/bdlmt/Throttle/nanosecondsPerAction.adoc[`nanosecondsPerAction`] 
| Return the time debt, in nanoseconds, that this `Throttle` is configured to incur for each action permitted&period;
| 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&period; Return 0 on success, and a non&hyphen;zero value (with no effect on `result`) if this throttle is configured such that `numActions` will never be permitted (i&period;e&period;, return an error if `numActions &gt; maxSimultaneousActions`) or if `numActions &lt;&equals; 0`&period; The returned `result` is an offset from the epoch of the system clock for which this throttle is configured&period; The behavior is undefined unless this throttle has been initialized (either by calling `initialize` or using a `BDLMT&lowbar;THROTTLE&lowbar;INIT&ast;` macro)&period; Note that `result` may be in the past, and this function does _not_ obtain the current time from the system clock&period;
| 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&lowbar;clockType`] 
| Clock type (monotonic or realtime) used by this throttle&period;
| xref:BloombergLP/bdlmt/Throttle/d_maxSimultaneousActions.adoc[`d&lowbar;maxSimultaneousActions`] 
| Total bucket capacity expressed in actions&period;
| xref:BloombergLP/bdlmt/Throttle/d_nanosecondsPerAction.adoc[`d&lowbar;nanosecondsPerAction`] 
| Nanoseconds consumed by each sustained action&period;
| xref:BloombergLP/bdlmt/Throttle/d_nanosecondsPerTotalReset.adoc[`d&lowbar;nanosecondsPerTotalReset`] 
| Total bucket capacity expressed in nanoseconds&period;
| xref:BloombergLP/bdlmt/Throttle/d_prevLeakTime.adoc[`d&lowbar;prevLeakTime`] 
| Effective time of the previous leak operation&period;
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlmt/Throttle/k_TEN_YEARS_NANOSECONDS.adoc[`k&lowbar;TEN&lowbar;YEARS&lowbar;NANOSECONDS`] 
| Ten years expressed in nanoseconds&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bdlmt/Throttle_InitHelper.adoc[BloombergLP::bdlmt::Throttle&lowbar;InitHelper]`
| &lsqb;*PRIVATE*&rsqb;This component private meta&hyphen;function is used to implement the initialization macros&period; This type provides the following&colon; &ast; Ensures arguments are evaluated at compile time (which won&apos;t be the case for floating point arguments) &ast; Enables compile time checks with BSLMF&lowbar;ASSERT &ast; Handles special cases if 0 is passed for `t&lowbar;MAX&lowbar;SIMULTANEOUS&lowbar;ACTIONS` or `t&lowbar;NANOSECONDS&lowbar;PER&lowbar;ACTION`
|===


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