rtapi_delay(3rtapi)
β¨ rtapi_delay β¨
ok bestie so this is rtapi_delay(3rtapi) β a page from the RTAPI manual, and it's literally just about spinning in a circle for a lil bit π
π NAME π
rtapi_delay β busy-loop for short delays π
πΈ SYNTAX πΈ
void rtapi_delay(long int nsec)
void rtapi_delay_max()
π¦ ARGUMENTS π¦
nsecβ the delay length you want, in nanoseconds. that's the dream. the goal. the vision board β¨
π DESCRIPTION π
so rtapi_delay is a simple delay. like, no thoughts head empty, it just loops. and bestie, looping means it's wasting CPU cycles the entire time π it's giving "spinning in the group chat waiting for a reply" energy. so it's only meant for short delays. periodt.
rtapi_delay_max tells you the maximum delay that's permitted β usually approximately 1/4 of the clock period β° and here's the tea: if you call rtapi_delay asking for a delay longer than the max, you don't get what you asked for, you just get delayed for the max time only. so rude but that's the rules π
you should call rtapi_delay_max before you start using rtapi_delay, so you can make sure the delays you actually need can even be achieved. vibe check first, delay second π«Ά
and ngl the actual resolution of the delay is unpredictable in the cutest way possible: it may be as good as one nano-second β¨ or as bad as several microseconds π no in-between promised, iykyk.
β±οΈ REALTIME CONSIDERATIONS β±οΈ
may be called from init/cleanup code, and from within realtime tasks. so it's allowed in both places, slay π
π RETURN VALUE π
rtapi_delay_max returns the maximum delay permitted. that's it, that's the whole return π
π SEE ALSO π
ok bye my love, that's the whole page!! this lil doc is from the LinuxCNC Documentation, dated 2006-10-12, and it lives in the RTAPI section as rtapi_delay(3rtapi) π thanks for reading bestie, go take a lil nanosecond nap πβ¨π¦
π¦ where this page comes from
- debian bookworm: linuxcnc-uspace-dev 2.9.0~pre1+git20230208.f1270d6ed7-1+deb12u2 Β· GFDL-1.1-or-later
- debian trixie: linuxcnc-uspace-dev 1:2.9.4-2+deb13u1 Β· GFDL-1.1-or-later
- ubuntu questing: linuxcnc-uspace-dev 1:2.9.4-2ubuntu2
- ubuntu resolute: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms