KTIMER(9) | Kernel Developer's Manual | KTIMER(9) |
ktimer
,
ke_timer_init
, ke_timer_set
,
ke_timer_cancel
— dispatcher
timer object
#include
<kdk/kern.h>
void
ke_timer_init
(ktimer_t
*timer);
void
ke_timer_set
(ktimer_t
*timer, uint64_t
nanosecs);
void
ke_timer_cancel
(ktimer_t
*timer);
The timer object is an object that can be set to expire at a certain time in the future. When the timer expires, it becomes signalled and waiters are awoken, then the timer is disabled again and set non-signalled.
The
ke_timer_init
()
function initialises a timer object.
The
ke_timer_set
()
function sets the timer to expire at the time specified by the
nanosecs parameter.
If the timer is already set, an attempt will be made to cancel the timer. If it cannot be cancelled, which means the timer is currently becoming signalled, the function will spin for a short time until the signalling is complete, and then the timer will be set to the new value.
The
ke_timer_cancel
()
function tries to cancel the timer. If the timer is already in the process
of becoming signalled, the function will spin for a short time until the
signalling is complete, and then the timer will be cancelled.
All these functions may be called from any context at or below
kIPLDPC
.
These functions are implemented in kernel/kern/timer.c.
Additional logic for the timer is implemented in kernel/kern/clock.c.
The interface is declared in kernel/include/kdk/kern.h.
These interfaces have always been in Keyronex.
October 6, 2024 | Debian |