Why does SDL_SetThreadPriority() have no SDL_Thread* argument (anymore)


When I ported Doom3BFG’s threading code to SDL2, setting thread
priorities was a bit painful.
The interface of the function I had to implement was like:
uintptr_t Sys_CreateThread( xthread_t function, void* parms,
xthreadPriority priority, const char* name )
(ok, there are actually more arguments but I ignore them).

So I had to create a thread with a given name and function and
parameters (really easy with SDL so far) - and a priority.

It could have been really easy, like:
// map priority to sdl_prio
SDL_Thread* t = SDL_CreateThread(function, name parms);
SDL_SetThreadPriority(t, sdl_prio));

Instead I had to write a wrapperfunction (to be passed to
SDL_CreateThread()) that sets the priority and then calls the original
function with the original parameters - a lot of extra code.[1]

Then I found out that the original implementation (5506:82a09d5d0f07)
actually had a a SDL_Thread* argument - and was changed a few commits
later in 5509:5b1b4d820d10.

Why was it changed?


  • Daniel