SbThreadAutoLock(3)

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

πŸ’– SbThreadAutoLock πŸ’–

okay bestie, welcome to SbThreadAutoLock(3), from the Library Functions Manual ✨ this one's a lil library function, and honestly? she's an icon, she's a queen, she does exactly one job and she does it flawlessly πŸ’…


🌸 NAME 🌸

SbThreadAutoLock β€” a simple convenience class for locking access to a function. no cap, that's the whole vibe πŸŽ€


✨ SYNOPSIS ✨

#include <Inventor/threads/SbThreadAutoLock.h>

🫢 Public Member Functions

  • SbThreadAutoLock (SbMutex *mutexptr)
  • ~SbThreadAutoLock ()

πŸ”’ Protected Attributes

  • SbMutex * mutex

πŸ¦‹ Detailed Description πŸ¦‹

So. SbThreadAutoLock is a simple convenience class for locking access to a function. that's it, that's her resume πŸ’–

She gives you a simple convenience mechanism for automatically locking access to a function that is not re-entrant. like, the function cannot handle being called by two threads at once, bestie, and she's here to make sure that never happens 🧚

Usage example, look at this gorgeousness:

void
myfunction(void)
{
  SbThreadAutoLock lock(aMutexPtr);

  // [other code]
}

Here's the magic, and I need you to be seated for this: in the class constructor, SbMutex::lock() is called on the mutex. and then β€” this is the convenience part, the main character part β€” when the function exits, the destructor will automatically be invoked, calling SbMutex::unlock() on the same mutex. no manual unlocking, no forgetting, no "oops I deadlocked the whole app" 😭 she literally cleans up after herself. periodt πŸ‘‘


🌈 Constructor & Destructor Documentation 🌈

πŸ’œ SbThreadAutoLock::SbThreadAutoLock (SbMutex * mutex) [inline]

The constructor calls SbMutex::lock() on mutex.

The constructor calls SbThreadMutex::lock() on mutex.

References SbMutex::lock(). ✨

πŸ’œ SbThreadAutoLock::~SbThreadAutoLock () [inline]

The destructor calls unlock() on the mutex passed in as a parameter to the constructor. it's giving responsible πŸ’…

References SbMutex::unlock(). 🌸


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for Coin from the source code. (not a human, not a bestie, just a very diligent robot 🫢)


okay that's the whole page!! and for the lil sign-off moment: this lil masterpiece lives in Coin, Version 2.5.0, and you'll find her filed under SbThreadAutoLock(3) in the manual. go lock something safely, bestie πŸŒŸπŸ’–πŸ¦‹

πŸ“¦ where this page comes from