When does SDL_UnlockMutex and all other functions from the mutex category fail? Do they fail in the correct code? How should I handle such fails? Should I assume that the mutex is in the unlocked state after fail?
Fails depend a bit on the platform you are compiling for, but - AFAIK - passing null mutexes or trying to unlock a mutex from a different thread than the one that locked it are some possible reasons for it to fail. Have a look at the implementations in the source code if you are interested in more infos.