#include <userver/utils/cpu_relax.hpp>
Utility to yield every N iterations in a CPU-bound task to give other tasks an opportunity to get CPU time
Definition at line 33 of file cpu_relax.hpp.
Public Member Functions | |
| CpuRelax (std::size_t every, tracing::ScopeTime *scope) | |
| CpuRelax (const CpuRelax &)=delete | |
| CpuRelax (CpuRelax &&)=delete | |
| void | Relax () |
| Call this method every iteration, eventually it will yield. | |
|
explicit |
| every | number of iterations to call yield. 0 = noop |
| scope | the tracing::ScopeTime to pause when yielding, if any |
ScopeTime must live at least as long as the CpuRelax