SDL_SetCurrentThreadPriority(3)

πŸ’– SDL_SetCurrentThreadPriority πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the group chat, where today's main character is SDL_SetCurrentThreadPriority from <SDL3/SDL_thread.h> β€” yes, it's giving thread glow-up energy and we're obsessed πŸ’…


✨ NAME ✨

SDL_SetCurrentThreadPriority β€” set the priority for the current thread, no cap.


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_thread.h>

bool SDL_SetCurrentThreadPriority(SDL_ThreadPriority priority);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, and it's lowkey important: some platforms will not let you alter the priority at all β€” or, if they do, they might only let you bump the thread up to a higher priority, never down. and some platforms are extra and require you to be an administrator account just to do it 😭

so basically? be prepared for this to fail. like, genuinely. it's not a skill issue, it's a platform vibe check. πŸ™ˆ

fr fr, don't assume success β€” check the return value, bestie.

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • priority β€” the SDL_ThreadPriority you wanna set. that's the whole assignment. slay. ✨

🌈 RETURN VALUE 🌈

returns true on success, or false on failure β€” and when it's a flop, call SDL_GetError() to find out more info about what went wrong. periodt.


πŸ’œ THREAD SAFETY πŸ’œ

it is safe to call this function from any thread. yes, ANY. go off, king πŸ‘‘


⭐ AVAILABILITY ⭐

this function has been available since SDL 3.2.0. iconic since day one, honestly.


Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_SetCurrentThreadPriority(3)

and that's the whole page, bestie 🫢 go forth, set those priorities (responsibly), and remember: if it returns false, it's not you, it's the platform. mwah πŸ’‹πŸ“

πŸ“¦ where this page comes from