refcount_dec_and_lock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so welcome to refcount_dec_and_lock(9), straight out of the Kernel API Manual β€” the manual page, the moment, the icon. The function is refcount_dec_and_lock, and its official NAME vibe is: return holding spinlock if able to decrement refcount to 0. That's the whole thesis, bestie. πŸ’…

✨ SYNOPSIS ✨

bool refcount_dec_and_lock (refcount_t *r , spinlock_t *lock );

πŸŽ€ ARGUMENTS πŸŽ€

  • r β€” the refcount. literally the counter in question.
  • lock β€” the spinlock to be locked. yes ma'am.

πŸ¦‹ DESCRIPTION πŸ¦‹

Similar to atomic_dec_and_lock, it will WARN on underflow 😭 and fail to decrement when saturated at REFCOUNT_SATURATED.

It provides release memory ordering, such that prior loads and stores are done before, and provides a control dependency such that free must come after. See the comment on top for the full lore. πŸ‘‘

🌸 RETURN 🌸

  • true β€” and hold spinlock if able to decrement refcount to 0. slay.
  • false β€” otherwise. no spinlock-holding moment for you, bestie.

🌈 SEE ALSO 🌈


source/version: ./lib · date: October 2026 · manual name: refcount_dec_and_lock(9). that's the cute little footer flex, and yes, you may screenshot it. 🫢✨

πŸ“¦ where this page comes from