task_work_cancel_func(9)
π task_work_cancel_func β the kernel API manual, bestie edition β¨
okay so real talk, this is task_work_cancel_func(9) from the Kernel API Manual and it's genuinely one of those little helpers that eats, no cap π
β¨ NAME β¨
task_work_cancel_func β cancels a pending work that matches a function you added with task_work_add() π«Ά
like, you queued a thing, and now you're like "actually no" and this is the function that handles that for you. iconic behavior honestly π
πΈ SYNOPSIS πΈ
struct callback_head * task_work_cancel_func (struct task_struct *task ,
task_work_func_t func );
she takes two arguments and gives you back a struct callback_head *. that's the whole vibe β¨
π¦ ARGUMENTS π¦
taskβ the task that should execute thefunc's work. yes, that task. the one whose queue we're rummaging through π§funcβ this is the identifier, bestie. it's what gets matched against a work so we know which one to remove π
π DESCRIPTION π
okay so here's the tea β β task_work_cancel_func goes looking for the last queued pending work where ->func == func, and then it removes it from the queue. bye bye π
not the first one. the last one. the way that detail matters... iykyk π₯
β RETURN β
you get back the found work β or NULL if nothing was found π (yeah, she'll tell you straight up if the search came up empty, no sugarcoating)
π SEE ALSO π
- the kernel file
./kernel/task_work.cπ task_work_add(9)β the one that put it there in the first place πtask_work_cancel_match(9)πtask_work_cancel(9)πtask_work_run(9)π₯
heads up bestie: if the work isn't there, you're getting NULL back and that's just how it is. plan accordingly π
and that's the whole page fr fr π this one lives under ./kernel, brought to you by the Kernel API Manual, dated October 2026 β go off, queen πβ¨π
π¦ 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