SDL_SetLinux...rityAndPolicy(3)
π NAME π
SDL_SetLinuxThreadPriorityAndPolicy β bestie, this one sets the priority (not nice level, okay, don't get it twisted) and the scheduling policy for a thread. It's giving "I'm the main character of the CPU scheduler" energy. π
This page lives in the SDL3 FUNCTIONS section of the manual, just so you know where you are. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_system.h>
bool SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
That's the whole vibe. Three args, one bool back, no cap. π
π¦ DESCRIPTION π¦
So like, what this actually does? It uses setpriority() if possible, and RealtimeKit if it's available. That's it, that's the tea. π
Basically it's out here trying the normal route first, and if that doesn't work out it'll go hang with RealtimeKit instead. Very resourceful of it, honestly. Obsessed. β¨
πΈ FUNCTION PARAMETERS πΈ
threadIDβ the Unix thread ID you wanna change the priority of. Like, the actual thread, not a vibe, a real one. π§΅sdlPriorityβ the newSDL_ThreadPriorityvalue. This is the SDL-flavoured priority, iykyk. πschedPolicyβ the new scheduling policy, and the options areSCHED_FIFO,SCHED_RR,SCHED_OTHER,etc...β yes it really says etc, pick your fighter. π₯
π RETURN VALUE π
Returns true on success or false on failure. And if it fails, don't just sit there spiraling β call SDL_GetError() for more information, she will tell you what went wrong. π
Lowkey important:falsemeans something broke.SDL_GetError()is your bestie in that moment, fr fr.
π«Ά THREAD SAFETY π«Ά
It is safe to call this function from any thread. Any. Thread. Go off, you multitasking icon. π
β AVAILABILITY β
This function is available since SDL 3.2.0. So if you're on something older... girl, update. π
Simple Directmedia Layer β’ SDL 3.4.18 β that's the source and version and date situation, mwah, thanks for coming to my TED talk, ily, go set some priorities bestie ππβ¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms