SDL_SetLinuxThreadPriority(3)

✨ SDL_SetLinuxThreadPriority ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages πŸ’– this one is SDL_SetLinuxThreadPriority(3) and it's literally the "hey Linux, be nice to this thread pls" button. Linux-specific, thread-specific, immaculate vibes only πŸŽ€


🌸 NAME 🌸

SDL_SetLinuxThreadPriority β€” sets the UNIX nice value for a thread πŸ’…

like. it changes how nice a thread is to everybody else. no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_system.h>

bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority);

she's short, she's sweet, she takes a thread ID and a priority, periodt ✨


πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea β˜• β€” this function uses setpriority() if possible, and RealtimeKit if available. that's the whole trick. it tries the plain old syscall route first, and if RealtimeKit is hanging around, that's on the table too 🧚


πŸ“ FUNCTION PARAMETERS πŸ“

  • threadID β€” the Unix thread ID you wanna change the priority of. yes, Unix thread ID. don't come in here with something else, she will not know her πŸ”₯
  • priority β€” the new, Unix-specific, priority value. that's the nice value vibe you're going for πŸ’«

⭐ RETURN VALUE ⭐

  • returns true on success πŸŽ‰
  • returns false on failure 😭 and in that case you gotta call SDL_GetError() for more information, because she will not tell you why directly. she'll just point you at the error function. iconic behaviour honestly.

🫢 THREAD SAFETY 🫢

it is safe to call this function from any thread πŸ‘‘ go off, call it from wherever, she can handle it.


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0 ✨ so if you're on something older, sorry bestie, you're out of luck πŸ™ˆ


lowkey reminder: it's Linux-flavoured. the name says Linux for a reason πŸ§πŸ’–

and that's the whole page, no crumbs left πŸ’… brought to you by the Simple Directmedia Layer girlies, version SDL 3.4.18, and this very SDL_SetLinuxThreadPriority(3) page πŸŽ€ mwah, go set some priorities bestie πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from