MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / activate_timer

Method activate_timer

rate_limiter/src/lib.rs:297–303  ·  view source on GitHub ↗

Arm the timer of the rate limiter with the provided `Duration` (which will fire only once).

(&mut self, dur: Duration, flag: &AtomicBool)

Source from the content-addressed store, hash-verified

295impl RateLimiterInner {
296 // Arm the timer of the rate limiter with the provided `Duration` (which will fire only once).
297 fn activate_timer(&mut self, dur: Duration, flag: &AtomicBool) {
298 // Panic when failing to arm the timer (same handling in crate TimerFd::set_state())
299 self.timer_fd
300 .reset(dur, None)
301 .expect("Can't arm the timer (unexpected 'timerfd_settime' failure).");
302 flag.store(true, Ordering::Relaxed);
303 }
304}
305
306impl RateLimiter {

Callers 1

consumeMethod · 0.80

Calls 1

resetMethod · 0.45

Tested by

no test coverage detected