read_poll_timeout_atomic(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ read_poll_timeout_atomic(9) ✨

okay bestie, so this is from the Kernel API Manual β€” say hi to read_poll_timeout_atomic(9) πŸ’… it's a macro that just keeps poking at an address until the vibe is right or it gives up. iconic behavior honestly.


🌸 NAME 🌸

read_poll_timeout_atomic β€” periodically poll an address until a condition is met or a timeout occurs πŸŽ€


⭐ SYNOPSIS ⭐

read_poll_timeout_atomic (op , val , cond , delay_us , timeout_us ,
delay_before_read , args... );

πŸ’– ARGUMENTS πŸ’–

  • op β€” the accessor function, bestie. it takes args as its arguments 🫢
  • val β€” the variable you're reading the value into
  • cond β€” the break condition, usually involving val. this is the "ok we can stop now" check ✨
  • delay_us β€” how long to udelay between reads, in us. 0 means tight-loops πŸ”₯ and like, please actually read the udelay function description for the details and limitations, i'm serious, there's lore there
  • timeout_us β€” timeout in us. 0 means never timeout 😭 (yes, forever. main character energy but make it infinite)
  • delay_before_read β€” if this is true, it delays delay_us before the read πŸ‘‘
  • args β€” the arguments for op poll

πŸ¦‹ DESCRIPTION πŸ¦‹

so the whole moment here: this macro does not rely on timekeeping. none. zero. not a crumb. 🌈 which means it's safe to call even when timekeeping is suspended β€” slay β€” but at the expense of an underestimation of wall clock time. ngl that underestimation is rather minimal when you have a non-zero delay_us, so it's giving "fine, actually" πŸ’€

and when available, you'll probably want to use one of the specialized macros defined below rather than this macro directly. like, this one is the general-purpose bestie, the specialists are the ones who actually know the assignment πŸ’œ


πŸŽ€ RETURN πŸŽ€

0 on success, and -ETIMEDOUT upon a timeout. either way, the last read value at args is stored in val 🌟


🧚 SEE ALSO 🧚

Kernel file ./include/linux/iopoll.h β€” plus these icons: poll_timeout_us(9), poll_timeout_us_atomic(9), read_poll_timeout(9), readx_poll_timeout(9), readx_poll_timeout_atomic(9) πŸ’«


lowkey a reminder that 0 for timeout_us means never timing out, and 0 for delay_us means tight-looping β€” pick your chaos consciously, bestie πŸ™ˆ

okay that's the whole page!! this one's from ./include/linux in the October 2026 era β€” mwah, go poll something responsibly πŸ’…πŸ’–πŸŽ€

πŸ“¦ where this page comes from