|
@@ -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;
|
|
|
}
|
|
|
|