rtapi_prio(3rtapi)
π rtapi_prio β thread priority functions π
okay bestie, welcome to the rtapi_prio(3rtapi) page, aka the part of the RTAPI manual where we figure out who gets to cut the line π₯
β¨ SYNTAX β¨
int rtapi_prio_highest()
int rtapi_prio_lowest()
int rtapi_prio_next_higher(int prio)
int rtapi_prio_next_lower(int prio)
four lil functions, four lil vibes, all of them returning an int π
π ARGUMENTS π
prioβ a value that came out of a previousrtapi_prio_xxxcall. that's it. that's the whole argument. don't get cute and pass a random number, it has to be one of these numbers π«Ά
πΈ DESCRIPTION πΈ
so the rtapi_prio_xxxx functions are your portable glow-up for setting task priority β¨ like, the actual mapping from "real priority" to "priority number" is RTOS-dependent β every realtime OS does its own thing β but this API keeps you from having to care about that. iconic behaviour honestly.
priorities range from rtapi_prio_lowest all the way up to rtapi_prio_highest, inclusive π¦ and to use this API you pick one of two methods, no third option, we don't do that here:
- Set your lowest priority task to
rtapi_prio_lowest, and then for each task at the next lowest priority, set their priorities tortapi_prio_next_higher(previous). you're building the ladder from the bottom up, bestie πͺ - Set your highest priority task to
rtapi_prio_highest, and then for each task at the next highest priority, set their priorities tortapi_prio_next_lower(previous). same ladder, but you're climbing down from the top π
N.B. a high priority task will preempt or interrupt a lower priority task. and Linux is always the lowest priority! no cap. Linux is the lowest. periodt. π
π REALTIME CONSIDERATIONS π
call these functions only from within init/cleanup code. not from realtime tasks. like, do not. I'm serious. realtime tasks are not the place for this, it's giving "undefined chaos" and we are not about that π
β RETURN VALUE β
returns an opaque real-time priority number. opaque means: you don't peek inside it, you don't do math on it, you just hand it back to the API and let it cook π
π SEE ALSO π
okay that's the whole page, you ate that π go forth and prioritise responsibly. this little love letter came from the LinuxCNC Documentation, dated 2006-10-12, filed under rtapi_prio(3rtapi) πβ¨ bye bestie, mwah π
π¦ 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