Lines Matching full:timer
5 //! Allows running timer callbacks without doing allocations at the time of
6 //! starting the timer. For now, only one timer per type is allowed.
53 //! A timer is initialized in the **stopped** state. A stopped timer can be
55 //! `start` operation, the timer is in the **started** state. When the timer
56 //! **expires**, the timer enters the **running** state and the handler is
57 //! executed. After the handler has returned, the timer may enter the
59 //! handler. A timer in the **started** or **running** state may be **canceled**
60 //! by the `cancel` operation. A timer that is cancelled enters the **stopped**
63 //! A `cancel` or `restart` operation on a timer in the **running** state takes
64 //! effect after the handler has returned and the timer has transitioned
67 //! A `restart` operation on a timer in the **stopped** state is equivalent to a
91 /// A timer backed by a C `struct hrtimer`.
95 /// * `self.timer` is initialized by `bindings::hrtimer_setup`.
100 timer: Opaque<bindings::hrtimer>, field
109 // SAFETY: Timer operations are locked on the C side, so it is safe to operate
110 // on a timer from multiple threads.
114 /// Return an initializer for a new timer instance.
120 // INVARIANT: We initialize `timer` with `hrtimer_setup` below. in new()
121 timer <- Opaque::ffi_init(move |place: *mut bindings::hrtimer| { in new()
148 // SAFETY: The field projection to `timer` does not go out of bounds, in raw_get()
151 unsafe { Opaque::raw_get(core::ptr::addr_of!((*this).timer)) } in raw_get()
154 /// Cancel an initialized and potentially running timer.
156 /// If the timer handler is running, this function will block until the
159 /// Note that the timer might be started by a concurrent start operation. If
160 /// so, the timer might not be in the **stopped** state when this function
165 /// returned when the timer was started.
187 /// `Self` must be [`Sync`] because it is passed to timer callbacks in another
190 /// Starting a timer returns a [`HrTimerHandle`] that can be used to manipulate
191 /// the timer. Note that it is OK to call the start function repeatedly, and
193 /// exist. A timer can be manipulated through any of the handles, and a handle
194 /// may represent a cancelled timer.
196 /// A handle representing a started or restarted timer.
198 /// If the timer is running or if the timer callback is executing when the
200 /// until the timer is stopped and the callback has completed.
206 /// Start the timer with expiry after `expires` time units. If the timer was
223 /// A handle representing a running timer.
227 /// If the timer is running, or if the timer callback is executing when the
229 /// until the timer is stopped and the callback has completed.
232 /// Start the timer after `expires` time units. If the timer was already
237 /// Caller promises keep the timer structure alive until the timer is dead.
247 /// timer is dead and the timer handler is not running.
249 /// Start the timer to run after `expires` time units and immediately
250 /// after call `f`. When `f` returns, the timer is cancelled.
257 // handle returned by [`UnsafeHrTimerPointer::start`] ensures that the timer is
267 // SAFETY: We drop the timer handle below before returning. in start_scoped()
275 /// Implemented by [`HrTimerPointer`] implementers to give the C timer callback a
283 /// Callback to be called from C when timer fires.
288 /// to the `bindings::hrtimer` structure that was used to start the timer.
292 /// Implemented by structs that can be the target of a timer callback.
295 /// the timer expires.
298 /// Called by the timer logic when the timer fires.
304 /// A handle representing a potentially running timer.
306 /// More than one handle representing the same timer might exist.
310 /// When dropped, the timer represented by this handle must be cancelled, if it
311 /// is running. If the timer handler is running when the handle is dropped, the
317 /// Cancel the timer. If the timer is in the running state, block till the
320 /// Note that the timer might be started by a concurrent start operation. If
321 /// so, the timer might not be in the **stopped** state when this function
326 /// Implemented by structs that contain timer nodes.
328 /// Clients of the timer API would usually safely implement this trait by using
377 /// Start the timer contained in the `Self` pointed to by `self_ptr`. If
383 /// - Caller must ensure that the pointee of `this` lives until the timer
402 /// Timer should not be restarted.
404 /// Timer should be restarted.
419 /// Timer expires at the given expiration time.
421 /// Timer expires after the given expiration time interpreted as a duration from now.
423 /// Timer does not move between CPU cores.
425 /// Timer handler is executed in soft irq context.
427 /// Timer handler is executed in hard irq context.
429 /// Timer expires at the given expiration time.
430 /// Timer does not move between CPU cores.
432 /// Timer expires after the given expiration time interpreted as a duration from now.
433 /// Timer does not move between CPU cores.
435 /// Timer expires at the given expiration time.
436 /// Timer handler is executed in soft irq context.
438 /// Timer expires after the given expiration time interpreted as a duration from now.
439 /// Timer handler is executed in soft irq context.
441 /// Timer expires at the given expiration time.
442 /// Timer does not move between CPU cores.
443 /// Timer handler is executed in soft irq context.
445 /// Timer expires after the given expiration time interpreted as a duration from now.
446 /// Timer does not move between CPU cores.
447 /// Timer handler is executed in soft irq context.
449 /// Timer expires at the given expiration time.
450 /// Timer handler is executed in hard irq context.
452 /// Timer expires after the given expiration time interpreted as a duration from now.
453 /// Timer handler is executed in hard irq context.
455 /// Timer expires at the given expiration time.
456 /// Timer does not move between CPU cores.
457 /// Timer handler is executed in hard irq context.
459 /// Timer expires after the given expiration time interpreted as a duration from now.
460 /// Timer does not move between CPU cores.
461 /// Timer handler is executed in hard irq context.
532 // `box` is a reserved keyword, so prefix with `t` for timer