futex_queue(9)
π futex_queue(9) π
okay so bestie, welcome to the futex_queue(9) page from the Kernel API Manual β this is the one that teaches you how to yeet a futex_q onto a futex_hash_bucket. buckle up, it's shorter than your attention span but every word slaps π
β¨ NAME β¨
futex_queue β enqueue the futex_q on the futex_hash_bucket. that's it. that's the whole personality. π
πΈ SYNOPSIS πΈ
void futex_queue (struct futex_q *q , struct futex_hash_bucket *hb ,
struct task_struct *task );
π¦ ARGUMENTS π¦
qβ thefutex_qyou're enqueueing, your main character struct πhbβ the destination hash bucket, aka where it's gonna live rent-freetaskβ the task queueing this futex, iykyk
π DESCRIPTION π
okay so listen: the caller must be holding hb->lock, and β plot twist β this function releases it right here. so like, don't come back expecting to still have it, bestie π
a call to futex_queue is typically paired with exactly one call to futex_unqueue. note the "exactly one," because the vibes are strict fr fr.
the exceptions? they involve the PI related operations π β those may use futex_unqueue_pi instead, or nothing at all if the unqueue is done as part of the wake process and the unqueue state is implicit in the state of the woken task (peep futex_wait_requeue_pi for an example, it's literally the blueprint π«Ά).
also note:taskmay beNULL, for async usage of futexes. yes,NULL. it's giving flexible, it's giving "we don't always need a task bestie" π
π₯ SEE ALSO π₯
- Kernel file
./kernel/futex/futex.h struct futex_q(9)futex_match(9)struct futex_vector(9)
and that's the whole page, no crumbs left π this one's brought to you by ./kernel/futex, dated October 2026 β mwah, go forth and enqueue responsibly πβ
π¦ 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