mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-09 01:25:41 +00:00
thread: fix inconsistent return values
- SDL_CreateMutex returns NULL when the creation fails (ngage) - SDL_SemValue returns 0 when the semaphore is NULL (n3ds) (cherry picked from commit 6875e1c262ae968a4fb52b367cf6912d9c76d4c9)
This commit is contained in:
parent
89e9f7b42b
commit
fcd7d658dc
|
@ -114,7 +114,8 @@ Uint32
|
||||||
SDL_SemValue(SDL_sem *sem)
|
SDL_SemValue(SDL_sem *sem)
|
||||||
{
|
{
|
||||||
if (sem == NULL) {
|
if (sem == NULL) {
|
||||||
return SDL_InvalidParamError("sem");
|
SDL_InvalidParamError("sem");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return sem->semaphore.current_count;
|
return sem->semaphore.current_count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ SDL_CreateMutex(void)
|
||||||
TInt status = CreateUnique(NewMutex, &rmutex, NULL);
|
TInt status = CreateUnique(NewMutex, &rmutex, NULL);
|
||||||
if (status != KErrNone) {
|
if (status != KErrNone) {
|
||||||
SDL_SetError("Couldn't create mutex.");
|
SDL_SetError("Couldn't create mutex.");
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
SDL_mutex* mutex = new /*(ELeave)*/ SDL_mutex;
|
SDL_mutex* mutex = new /*(ELeave)*/ SDL_mutex;
|
||||||
mutex->handle = rmutex.Handle();
|
mutex->handle = rmutex.Handle();
|
||||||
|
|
Loading…
Reference in a new issue