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 πŸ”₯


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