SDL_LockProperties(3)
π SDL_LockProperties(3) π
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_LockProperties β she's a whole vibe and she's about to keep your properties from getting absolutely bodied by other threads. let's get into it β¨
π NAME π
SDL_LockProperties β lock a group of properties, periodt.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_properties.h>
bool SDL_LockProperties(SDL_PropertiesID props);
π¦ DESCRIPTION π¦
so basically, this function grabs a multi-threaded lock for these properties. while you're holding it, any other thread that tries to lock these same properties is just gonna wait β standing outside the club, no entry, until you unlock them. π
β οΈ real talk: properties must be unlocked before they are destroyed. do not skip that step, i am begging.
here's the thing tho β the lock is automatically taken when setting individual properties. so this function isn't something you need for every lil' property write. you only reach for it when you wanna:
- set several properties atomically (all at once, no interlopers, no gaps) π₯
- guarantee that properties you're querying aren't freed in another thread while you're still looking at them π
that's it. that's the whole job. she's niche but she serves. π
π FUNCTION PARAMETERS π
propsβ the properties to lock. that's the one. the whole squad.
β RETURN VALUE β
Returns true on success, or false on failure β and if it fails, call SDL_GetError() for more info, because she will not elaborate unless you ask. π
π§ THREAD SAFETY π§
It is safe to call this function from any thread. no cap. every thread is invited to this party. π
π AVAILABILITY π
This function has been available since SDL 3.2.0. she's not new-new, but she's not ancient either. iykyk. π
π₯ SEE ALSO π₯
SDL_UnlockProperties(3)β the other half of the situationship, go unlock your stuff bestie π«Ά
mwah π that's the whole page. this one's from the Simple Directmedia Layer girlies, SDL 3.4.18 era β stay locked, stay atomic, and always unlock before you destroy. bye 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