poll_timeout_us_atomic(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… poll_timeout_us_atomic(9) β€” Kernel API Manual

okay bestie, welcome to the atomic polling macro page ✨ this one lives in the Kernel API Manual and it's genuinely one of those "small but mighty" situations, iykyk 🫢


✨ NAME ✨

poll_timeout_us_atomic β€” literally does what it says on the tin: it periodically polls and performs an operation until a condition is met or a timeout occurs πŸŽ€ no cap, that's the whole gig.


πŸ¦‹ SYNOPSIS πŸ¦‹

poll_timeout_us_atomic (op , cond , delay_us , timeout_us ,
       delay_before_op );

yes bestie, five arguments, all of them important, we do not skip a single one πŸ’…


🌸 ARGUMENTS 🌸

  • op β€” the Operation. this is the thing you actually want to do over and over until the universe cooperates ✨
  • cond β€” the Break condition. the second this is true, we're out, we're done, we're going home πŸƒβ€β™€οΈπŸ’¨
  • delay_us β€” the Time to udelay between operations, measured in us (0 means tight-looping πŸŒ€). and like... please read the udelay function description for details and limitations, fr fr, it's not optional reading πŸ™ˆ
  • timeout_us β€” the Timeout in us. and <rainbow>0 means never timeout</rainbow> πŸ‘‘ which like, bold of you, but slay.
  • delay_before_op β€” if it is true, delay delay_us before the operation πŸŽ€ (yes, before. the vibe check happens first.)

πŸ’– DESCRIPTION πŸ’–

the way this macro is so iconic: it does not rely on timekeeping πŸ•βœ¨ Hence it is safe to call even when timekeeping is suspended β€” which is huge for you atomic girlies. the trade-off? at the expense of an underestimation of wall clock time 😭 but honestly bestie, it's rather minimal with a non-zero delay_us, so like, barely a situation.

and when available, you'll probably want to use one of the specialized macros defined below rather than this macro directly 🫢 this one is the main character, but the specialists are the whole friend group.


πŸ’€ RETURN πŸ’€

  • 0 on success πŸŽ‰
  • -ETIMEDOUT upon a timeout πŸ˜” (it tried, it really did)

πŸ”₯ SEE ALSO πŸ”₯

go check out the Kernel file ./include/linux/iopoll.h β€” that's where the whole squad lives:


ok that's the page!! sourced from ./include/linux, dated October 2026, and it's the poll_timeout_us_atomic(9) manual page β€” go poll something responsibly bestie πŸ’œπŸ§šβ­
πŸ“¦ where this page comes from