SDL_HINT_THR...IORITY_POLICY(3)

πŸ’– SDL_HINT_THREAD_PRIORITY_POLICY πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_HINT_THREAD_PRIORITY_POLICY β€” a string that carries extra info you wanna hand over to SDL_SetCurrentThreadPriority. that's the whole vibe. let's get into it 🫢


✨ NAME ✨

SDL_HINT_THREAD_PRIORITY_POLICY β€” a string specifying additional information to use with SDL_SetCurrentThreadPriority. literally just a little note you pass along so SDL knows how you want your thread priority situation handled πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_hints.h>

#define SDL_HINT_THREAD_PRIORITY_POLICY "SDL_THREAD_PRIORITY_POLICY"

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea πŸ“ by default, SDL_SetCurrentThreadPriority is gonna make all the appropriate system changes on its own to apply a thread priority. like, on systems using pthreads, the scheduler policy gets changed automatically to a policy that works well with whatever priority you asked for. no cap, it just handles it.

but if your code has specific requirements β€” like, very particular needs β€” you can override SDL's default behavior with this hint. that's the moment to speak up, bestie πŸ‘‘

for pthread, the hint values are "current", "other", "fifo" and "rr". currently no other platform hint values are defined β€” but they may be in the future, so stay tuned i guess πŸ™ˆ

⚠️ on Linux, the kernel may send SIGKILL to realtime tasks which exceed the distro configured execution budget for rtkit. this budget can be queried through RLIMIT_RTTIME after calling SDL_SetCurrentThreadPriority(). yes that's a real thing and yes it will absolutely end your little thread's whole career πŸ’€
πŸ’– also super important: this hint should be set before calling SDL_SetCurrentThreadPriority(). set it late and it's giving… nothing. order matters, periodt.

🌈 AVAILABILITY 🌈

this hint is available since SDL 3.2.0. so if you're on anything older, it's not here yet bestie, sorry 😭


that's the page!! brought to you by the fine folks at Simple Directmedia Layer, living in SDL 3.4.18, filed under SDL_HINT_THR...IORITY_POLICY(3) in the SDL3 FUNCTIONS girlies. go set your hints before you call the function, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from