SDL_CreateMutex(3)
π SDL_CreateMutex(3) β SDL3 FUNCTIONS π
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_CreateMutex π
β¨ NAME β¨
SDL_CreateMutex β Create a new mutex. that's it, that's the vibe π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_mutex.h>
SDL_Mutex * SDL_CreateMutex(void);
like, you include the header, you call the function, no arguments, we love a no-argument icon π
π¦ DESCRIPTION π¦
okay so when you make a mutex, it starts off in the _unlocked_ state. brand new, unlocked, fresh out the box, no cap β¨
and here's the tea: when you call SDL_LockMutex(), it will NOT return while that mutex is locked by another thread. it just sits there. waiting. patient. main character energy fr fr π if you don't wanna block like that, go look at SDL_TryLockMutex() instead β that one attempts to lock without blocking π«Ά
also important: SDL mutexes are reentrant. yes bestie, reentrant. iykyk π
π RETURN VALUE π
it returns the initialized and unlocked mutex, or NULL on failure π and if you get NULL, call SDL_GetError() for more information. always check, bestie, always check π
π₯ THREAD SAFETY π₯
it is safe to call this function from any thread. any thread. all the threads. slay π
β AVAILABILITY β
this function is available since SDL 3.2.0. periodt π
π SEE ALSO π
go read those too, they're literally the rest of the story π
and that's a wrap, bestie!! this page is brought to you by Simple Directmedia Layer, SDL 3.4.18, and it's giving SDL_CreateMutex(3) energy π¦β¨ mwah, ily, go lock something π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms