futex_unqueue(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– futex_unqueue(9) β€” Kernel API Manual energy πŸ’–

✨ NAME ✨

futex_unqueue β€” remove the futex_q from its futex_hash_bucket. That’s the whole assignment, bestie πŸ’…

🌸 SYNOPSIS 🌸

int futex_unqueue (struct futex_q *q );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • q β€” the futex_q to unqueue. That’s it. That’s the argument. Slay πŸŽ€

πŸ’… DESCRIPTION πŸ’…

Okay so here’s the part where you gotta pay attention, bestie: q->lock_ptr must not be held by the caller. No cap, that’s important. πŸ”₯

A call to futex_unqueue must be paired with exactly one earlier call to futex_queue. Like, one-to-one, matching-set, no extra copies, periodt. ✨

🚨 Not me being dramatic, but fr fr: don’t hold q->lock_ptr when you call this, and don’t forget the matching earlier futex_queue call. That pairing rule is the vibe check.

πŸŽ€ RETURN πŸŽ€

  • 1 β€” if the futex_q was still queued (and we removed unqueued it); πŸ’–
  • 0 β€” if the futex_q was already removed by the waking thread. πŸ¦‹

🌈 SEE ALSO 🌈

Kernel file ./kernel/futex/core.c: __futex_hash(9), futex_setup_timer(9), get_futex_key(9), fault_in_user_writeable(9), futex_top_waiter(9), wait_for_owner_exiting(9), __futex_unqueue(9), futex_exit_recursive(9).


xoxo bestie β€” source/version: ./kernel/futex; date: October 2026 πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from