add_timer(9)
π add_timer(9) β like, the "start a timer" girlie π
okay so this is a page from the Kernel API Manual (add_timer(9)) and bestie, it's honestly so straightforward. we're starting a timer. that's the whole vibe. let me walk you through it π
β¨ NAME β¨
add_timer β Start a timer π
β¨ SYNOPSIS β¨
void add_timer (struct timer_list *timer );
like, that's it. one function, void return, one pointer. clean. iconic. π
β¨ ARGUMENTS β¨
timerβ The timer to be started. that's the one, that's the main character π
β¨ DESCRIPTION β¨
okay so what this does: you start timer so it expires at timer->expires in the future. and timer->expires is the absolute expiry time, measured in 'jiffies' β not relative, absolute, so don't come at it with "in 5 seconds" energy, it wants the actual tick number fr fr β°
when the timer expires, timer->function(timer) gets invoked from soft interrupt context. not regular context. softirq. noted π
β οΈ before you call this,timer->expiresandtimer->functionmust both already be set. both. of them. no skipping, no "it'll be fine" β it will not be fine π
and here's the little quirks, because of course there are quirks:
- if
timer->function == NULL, the start operation is silently discarded. like it just... doesn't happen. no error, no fuss, no warning. just vibes and nothingness π - if
timer->expiresis already in the past, the timer gets queued to expire at the next timer tick. close enough, we move π¦ - this can only operate on an inactive timer. if you try to invoke it on an active timer, it gets rejected with a warning. so do a vibe check on that timer state first, bestie, seriously π¨
β¨ SEE ALSO β¨
the whole friend group, literally all of them, no cap:
- Kernel file
./kernel/time/timer.cstruct timer_base(9) __round_jiffies_relative(9)round_jiffies(9)round_jiffies_relative(9)__round_jiffies_up_relative(9)round_jiffies_up(9)round_jiffies_up_relative(9)timer_init_key(9)mod_timer_pending(9)mod_timer(9)timer_reduce(9)add_timer_local(9)add_timer_global(9)add_timer_on(9)__timer_delete(9)timer_delete(9)timer_shutdown(9)__try_to_del_timer_sync(9)timer_delete_sync_try(9)__timer_delete_sync(9)timer_delete_sync(9)timer_shutdown_sync(9)fetch_next_timer_interrupt_remote(9)timer_unlock_remote_bases(9)timer_lock_remote_bases(9)timer_base_is_idle(9)timer_expire_remote(9)get_next_timer_interrupt(9)timer_base_try_to_set_idle(9)timer_clear_idle(9)__run_timers(9)
like I said. the whole group chat. go say hi π
and that's the page!! this one lives in ./kernel/time and it's dated October 2026 β so yeah, mark your calendar, that's the version and date we're repping ποΈβ¨ slay, you now understand add_timer(9). periodt. ππ«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms