complete(9)
β¨ complete(9) β¨
ok so bestie, we're in the kernel today β this is a page from the Kernel API Manual, and it's literally all about complete. yes, that's the whole name. iconic, honestly. π
πΈ SYNOPSIS πΈ
void complete (struct completion *x );
like, that's it. that's the function. put it in your code and go off, queen. π
π ARGUMENTS π
xβ holds the state of this particular completion. it's astruct completion *, and it's lowkey the whole personality of the call β it's where the state of this completion lives.
π DESCRIPTION π
okay so here's the vibe: complete will wake up a single thread waiting on this completion. just one. not a group, not a crowd β one thread gets the notification, and honestly good for them. π«Ά
and the order? threads will be awakened in the same order in which they were queued. first in line, first to wake up. no cutting, no chaos, fr fr. π
see also complete_all, wait_for_completion and related routines β those are the cousins of this function, and yes, they're all linked down below because we're thorough bestie. π
and heads up, this part matters: if this function wakes up a task, it executes a full memory barrier before accessing the task state. like, that's not a fun little detail, that's the memory-ordering guarantee, so don't sleep on it. π§
π¦ SEE ALSO π¦
kernel file ./kernel/sched/completion.c β that's where the magic lives, go read it if you're curious (iykyk) π
and here's the whole friend group, all of them, no cap:
complete_all(9)wait_for_completion(9)wait_for_completion_timeout(9)wait_for_completion_io(9)wait_for_completion_io_timeout(9)wait_for_completion_interruptible(9)wait_for_completion_interruptible_timeout(9)wait_for_completion_killable(9)wait_for_completion_killable_timeout(9)try_wait_for_completion(9)completion_done(9)
and that's the page!! π this one came from ./kernel/sched, dated October 2026 β so go forth, wake exactly one thread, respect the queue order, and remember the memory barrier. slay. πβ¨πΈ
π¦ 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