SDL_UnlockRWLock(3)
β¨ SDL_UnlockRWLock(3) β¨
okay bestie so this one is from the SDL3 FUNCTIONS collection β yeah, the manpage crew, manual name and all, we're just vibing here π
πΈ NAME πΈ
SDL_UnlockRWLock β unlock the read/write lock. that's it. that's the whole job. π
π SYNOPSIS π
#include <SDL3/SDL_mutex.h>
void SDL_UnlockRWLock(SDL_RWLock *rwlock);
π DESCRIPTION π
Use this function to unlock the rwlock, and lowkey it does not care whether it was locked for read-only or write operations β either way, this is your girl. π
Now here's the part where it gets cute: it is legal for the owning thread to lock an already-locked read-only lock. Yes bestie, she's re-entrant like that. β¨ But β and this is the catch β it must unlock it the same number of times before it is actually made available for other threads in the system. That's what they call a "recursive rwlock". Count your unlocks, fr fr. π’
β οΈ And now the scary part: it is illegal to unlock a rwlock that has not been locked by the current thread. Doing that = undefined behavior. Not "oopsie" behavior, not "probably fine" behavior β undefined. Do not. π«π
π«Ά FUNCTION PARAMETERS π«Ά
rwlockβ the rwlock to unlock. the one. the only. your problematic fave. π
π₯ THREAD SAFETY π₯
This call must be paired with a previous locking call on the same thread. no solo unlocks. no unlocking someone else's lock. it's giving committed relationship, not situationship. π«Άβ¨
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on something older, no she is not there, don't go looking. π
π SEE ALSO π
SDL_LockRWLockForReading(3)SDL_LockRWLockForWriting(3)SDL_TryLockRWLockForReading(3)SDL_TryLockRWLockForWriting(3)
go lock something, then come back and unlock it the same number of times. iykyk. π¦
okay that's the whole page, and a lil sign-off for the credits because they ate: this came to you from Simple Directmedia Layer, version SDL 3.4.18 β iconic, no cap. mwah. πππ¦
π¦ 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