mirror of https://github.com/encounter/SDL.git
Don't try to create a semaphore for the mutex implementation if threads are disabled
Fixes https://github.com/libsdl-org/SDL/issues/6344
This commit is contained in:
parent
33050fea39
commit
17b43b0fdd
|
@ -40,7 +40,9 @@ SDL_CreateMutex(void)
|
|||
SDL_mutex *mutex;
|
||||
|
||||
/* Allocate mutex memory */
|
||||
mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex));
|
||||
mutex = (SDL_mutex *) SDL_calloc(1, sizeof(*mutex));
|
||||
|
||||
#if !SDL_THREADS_DISABLED
|
||||
if (mutex) {
|
||||
/* Create the mutex semaphore, with initial value 1 */
|
||||
mutex->sem = SDL_CreateSemaphore(1);
|
||||
|
@ -53,6 +55,8 @@ SDL_CreateMutex(void)
|
|||
} else {
|
||||
SDL_OutOfMemory();
|
||||
}
|
||||
#endif /* !SDL_THREADS_DISABLED */
|
||||
|
||||
return mutex;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue