SbRWMutex(3)

πŸ“¦ version 2.5.0, in fedora 43, fedora 44

🌸 NAME 🌸

SbRWMutex β€” bestie it's literally the read/write mutex, the one that lets everybody read at the same time but makes them take turns to write πŸ’…


✨ SYNOPSIS ✨

#include <Inventor/threads/SbRWMutex.h>

πŸŽ€ Public Types πŸŽ€

enum Precedence { READ_PRECEDENCE, WRITE_PRECEDENCE }

πŸ¦‹ Public Member Functions πŸ¦‹

  • SbRWMutex (Precedence policy)
  • ~SbRWMutex (void)
  • int writeLock (void)
  • SbBool tryWriteLock (void)
  • int writeUnlock (void)
  • int readLock (void)
  • int tryReadLock (void)
  • int readUnlock (void)

πŸ’– Detailed Description πŸ’–

okay so SbRWMutex is a mutex, but like… the generous kind 😌 It's the one used to grant both read and write access to the data it's protecting. The vibe:

  • multiple threads can hold read locks on the data at the same time β€” sharing is caring, no cap
  • but only one write-lock can ever be handed out
  • and never while some other thread still has a read lock on the data

That's it, that's the whole energy πŸ”₯

Now, the policy on granting read locks to threads while another thread is out here waiting for the write lock β€” that's something that should be configurable at construction time… but which isn't at the moment. So it's giving "planned feature, not built yet" πŸ™ˆ. Noted, not fixed, moving on.


🫢 Constructor & Destructor Documentation 🫢

🌸 SbRWMutex::SbRWMutex (Precedence policy) [inline]

Constructor. ✨ It makes the thing. You hand it a Precedence policy and off you go.

🌸 SbRWMutex::~SbRWMutex (void ) [inline]

Destructor. πŸ’€ It un-makes the thing.


πŸ‘‘ Member Function Documentation πŸ‘‘

🌈 int SbRWMutex::writeLock (void ) [inline]

This method blocks the calling thread until it gains write lock status on the SbRWMutex object. Like, it will simply stand there in the queue, patiently, until it's its turn. No cutting 🚫

Referenced by SoDB::writelock().

🌈 SbBool SbRWMutex::tryWriteLock (void ) [inline]

This method tries to gain write lock status on the SbRWMutex. TRUE is returned if it was successful, FALSE otherwise. And bestie, this one is a non-blocking operation β€” it does not wait around, it asks once and respects the answer 🫑

🌈 int SbRWMutex::writeUnlock (void ) [inline]

This method is used for unlocking the calling thread's write lock. ✨ Give it back, you're done.

Referenced by SoDB::writeunlock().

🌈 int SbRWMutex::readLock (void ) [inline]

This method blocks the calling thread until it gains read lock status on the SbRWMutex object. Same patience, same queue, different lock πŸŽ€

Referenced by SoDB::readlock().

🌈 int SbRWMutex::tryReadLock (void ) [inline]

This method tries to gain read lock status on the SbRWMutex. TRUE is returned if it was successful, FALSE otherwise. Also a non-blocking operation β€” zero chill, zero waiting ⚑

🌈 int SbRWMutex::readUnlock (void ) [inline]

This method is used for unlocking the calling thread's read lock. πŸ’œ Put it back where you found it.

Referenced by SoDB::readunlock().

⭐ Author ⭐

Generated automatically by Doxygen for Coin from the source code. (So if a sentence sounds a lil robotic, that's why β€” the robot wrote it, I just gave it a glow-up 😭)


okay bestie that's the whole page, mwah 🫢 This was Coin, Version 2.5.0, page SbRWMutex(3) β€” periodt πŸ’…πŸŒΈβœ¨

πŸ“¦ where this page comes from