timer_delete(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… timer_delete β€” deactivate a timer, bestie

okay so you found a page in the Kernel API Manual, section 9, and honestly? iconic of you. this one's all about timer_delete, and it's lowkey one of the most "know what you're doing" functions in the timer family. let's get into it 🫢


🌸 NAME 🌸

timer_delete β€” Deactivate a timer

like, just turn it off. that's the whole vibe. ✨


πŸŽ€ SYNOPSIS πŸŽ€

int timer_delete (struct timer_list *timer );

one function, one arg, one int coming back at you. short and slay. πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • timer β€” The timer to be deactivated. yeah, that's the one you're putting to sleep. 😴

✨ DESCRIPTION ✨

okay so here's the tea, bestie, and you need to hear it. 🍡

this function only deactivates a pending timer. that's its one job. not me exaggerating β€” that's literally all it does.

but β€” and this is the important part β€” contrary to timer_delete_sync, it does not take into account whether the timer's callback function is concurrently executed on a different CPU or not. like, it's just not checking. not its business. πŸ™ˆ

it also neither prevents rearming of the timer. nope. no protection there either.

so here's the warning that's giving main character energy: if timer can be rearmed concurrently, then the return value of this function is meaningless. 😭 like fr fr, don't trust it. it's giving "i answered but the question changed while i was answering."

⚠️ so if there's any chance of concurrent rearming, treat that return value like a text from an ex β€” do not build your logic on it. πŸ’€

πŸ”₯ RETURN πŸ”₯

  • 0 β€” The timer was not pending. nothing to do, nothing was there. πŸ«₯
  • 1 β€” The timer was pending and deactivated. caught it, shut it down, slay. ✨

πŸ‘‘ SEE ALSO πŸ‘‘

okay bestie, buckle up, this list is long and it absolutely ate. 🌈

Kernel file ./kernel/time/timer.c struct 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(9), add_timer_local(9), add_timer_global(9), add_timer_on(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)


πŸ’œ one last thing πŸ’œ

this absolute baddie of a page lives in the ./kernel/time corner of the Kernel API Manual, dated October 2026. that's the whole footer, bestie β€” no cap, we got there. now go forth and deactivate responsibly. 🧚⭐

πŸ“¦ where this page comes from