poll_timeout_us(9)
π poll_timeout_us(9) β from the Kernel API Manual, bestie
okay so picture this: you're in kernel land, you've got an operation, you've got a condition, and you're just gonna sit there polling like a patient little angel until the condition hits or the clock runs out. that's the whole vibe of poll_timeout_us. it's giving "are we there yet" but make it β¨systems programmingβ¨.
β¨ NAME β¨
poll_timeout_us β periodically poll and perform an operation until a condition is met or a timeout occurs π
like, it keeps doing The Thing, over and over, until either the condition says "we're done babe" or the timeout says "time's up sweetie." no cap.
πΈ SYNOPSIS πΈ
poll_timeout_us (op , cond , sleep_us , timeout_us , sleep_before_op );
that's the whole signature, crown and all π β copy it exactly, don't get cute with it.
π¦ ARGUMENTS π¦
opβ Operation. the thing you want to keep doing. the main character of the loop πcondβ Break condition. when this goes true, we're out, we're done, we're free ποΈsleep_usβ Maximum time to sleep between operations, in us. and0means tight-loops β like, no sleeping at all, just absolutely feral spinning π. please read theusleep_rangefunction description for details and limitations, fr fr, don't skip it.timeout_usβ Timeout in us. and0means never timeout β it'll wait, like, forever, bestie. iconic of it honestly.sleep_before_opβ if it is true, sleepsleep_usbefore the operation. like stretching before the gym, but for polling π§
π DESCRIPTION π
okay so real talk: when available, you'll probably want to use one of the specialized macros defined below rather than this macro directly. that's not me being shady, that's just the manpage being honest π β this one's the general-purpose girlie, the specialized ones are the specialists.
π RETURN π
0on success β slay, we got there π-ETIMEDOUTupon a timeout β the clock said no β
β οΈ ok this part is IMPORTANT, listen up: it must not be called from atomic context ifsleep_usortimeout_usare used. like, don't do it. that's a you-problem you do not want π. atomic context + sleeping = bad time, no notes.
β SEE ALSO β
- Kernel file
./include/linux/iopoll.hβ go read it, iykyk π poll_timeout_us_atomic(9)read_poll_timeout(9)read_poll_timeout_atomic(9)readx_poll_timeout(9)readx_poll_timeout_atomic(9)
the whole friend group, honestly π«Ά all of them.
and that's the tea, bestie β this page lives at ./include/linux, dated October 2026, and it's filed under poll_timeout_us(9). go poll responsibly, mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms