complete(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 a struct 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:


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