SDL_DestroyMutex(3)
β¨ SDL_DestroyMutex β¨
okay bestie, welcome to the SDL_DestroyMutex(3) page, part of the SDL3 FUNCTIONS lineup π
this one's a lil short but it's SO important, don't skip it
πΈ NAME πΈ
SDL_DestroyMutex β destroy a mutex created with SDL_CreateMutex() π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_mutex.h>
void SDL_DestroyMutex(SDL_Mutex *mutex);
like. that's it. that's the whole call. one line, no return value, no drama π
π DESCRIPTION π
so here's the tea π this function must be called on any mutex that is no longer needed. like, it's not optional, bestie. failure to destroy a mutex will result in a system memory or resource leak and nobody wants that energy in their codebase, fr fr π
now the important part, and I need you to listen: while it is safe to destroy a mutex that is _unlocked_, it is not safe to attempt to destroy a locked mutex. and what happens if you do? undefined behavior, depending on the platform π like, it might work, it might explode, it's giving chaos, it's giving "why would you do this". so just... don't. unlock it first, queen π
π«Ά tl;dr: destroy your mutexes or leak forever. destroy unlocked mutexes only. locked ones = undefined behavior. periodt.
π FUNCTION PARAMETERS π
mutexβ the mutex to destroy. that's the one. the lil guy you're saying goodbye to π₯Ί
π THREAD SAFETY π
it is safe to call this function from any thread β¨ yes you heard that right, any thread, no cap. go off π§
β AVAILABILITY β
this function is available since SDL 3.2.0 π so if you're on anything older... bestie. upgrade. it's time π
π SEE ALSO π
SDL_CreateMutex(3)β the origin story, the birth of your mutex, the before to this after πΈ
and that's the whole page!! short, sweet, iconic, main character energy only π
Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_DestroyMutex(3) β mwah, go destroy some mutexes responsibly, bestie πβ¨π¦
π¦ 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