hwspin_lock...ut_in_atomic(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME

hwspin_lock_timeout_in_atomic β€” lock an hwspinlock with timeout limit πŸŽ€


✨ SYNOPSIS

int hwspin_lock_timeout_in_atomic (struct hwspinlock *hwlock , unsigned
int to );

🌸 ARGUMENTS

  • hwlock β€” the hwspinlock you're trying to lock, bestie. like, the actual lock object 🫢
  • to β€” timeout value in msecs. yes. milliseconds. write it down πŸ“

πŸ’– DESCRIPTION

okay so here's the tea β˜• β€” this function locks the underlying hwlock. that's it, that's the job.

but if the hwlock is already taken? πŸ‘€ the function will busy loop waiting for it to be released β€” just spinning, spinning, spinning, main character energy β€” but it gives up when timeout msecs have elapsed. no cap, it will genuinely walk away πŸ’€

🚨 important-ish warning, lowkey highkey: this function shall be called only from an atomic context, and the timeout value shall not exceed a few msecs. like, a few. don't be out here passing to = 30000 and acting surprised πŸ™ˆ

return value vibes: returns 0 when the hwlock was successfully taken πŸŽ‰ and an appropriate error code otherwise β€” most notably an -ETIMEDOUT if the hwlock is still busy after timeout msecs 😭

and the iconic part: the function will never sleep. not once. not ever. it's built different 🧚


πŸ¦‹ SEE ALSO

kernel file ./include/linux/hwspinlock.h β€” and the whole friend group, fr fr:


✨ that's the whole page bestie, you ate that ✨

source vibes: ./include/linux, dated October 2026 β€” screenshot it, cite it, slay πŸ’…πŸ’–πŸ‘‘

πŸ“¦ where this page comes from