sdlSetLinuxThreadPriorityAndPolicy function

bool sdlSetLinuxThreadPriorityAndPolicy(
  1. int threadId,
  2. int sdlPriority,
  3. int schedPolicy
)

Sets the priority (not nice level) and scheduling policy for a thread.

This uses setpriority() if possible, and RealtimeKit if available.

\param threadID the Unix thread ID to change priority of. \param sdlPriority the new SDL_ThreadPriority value. \param schedPolicy the new scheduling policy (SCHED_FIFO, SCHED_RR, SCHED_OTHER, etc...). \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy)

Implementation

bool sdlSetLinuxThreadPriorityAndPolicy(
    int threadId, int sdlPriority, int schedPolicy) {
  final sdlSetLinuxThreadPriorityAndPolicyLookupFunction =
      libSdl3.lookupFunction<
          Uint8 Function(Int64 threadId, Int32 sdlPriority, Int32 schedPolicy),
          int Function(int threadId, int sdlPriority,
              int schedPolicy)>('SDL_SetLinuxThreadPriorityAndPolicy');
  return sdlSetLinuxThreadPriorityAndPolicyLookupFunction(
          threadId, sdlPriority, schedPolicy) ==
      1;
}