SbThreadAutoLock(3)

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

πŸ’– NAME πŸ’–

SbThreadAutoLock β€” the simple convenience class for locking access to a function. that's it, that's the whole vibe ✨


🌸 SYNOPSIS 🌸

#include <Inventor/threads/SbThreadAutoLock.h>

πŸŽ€ Public Member Functions

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

πŸ¦‹ Protected Attributes

  • SbMutex * mutex
  • SbThreadMutex * recmutex

✨ Detailed Description ✨

okay bestie, so. SbThreadAutoLock is the simple convenience class for locking access to a function. 🫢

what it does is give you a simple convenience mechanism for automatically locking access to a function that is not re-entrant. no cap.

Usage example, and yes you're gonna want to screenshot this:

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

  // [other code]
}

the way this works is: in the class constructor, SbMutex::lock() gets called on the mutex. and then when the function exits β€” this is the convenience part, this is the whole moment, the main character energy β€” the destructor gets automatically invoked, and it calls SbMutex::unlock() on that same mutex. it's giving RAII. it's giving scoped lock. it's giving iconic. πŸ’…


πŸ‘‘ Constructor & Destructor Documentation πŸ‘‘

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

the constructor calls SbMutex::lock() on mutex. that's it. that's the job. slay.

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

the constructor calls SbThreadMutex::lock() on mutex. same energy, different mutex type. πŸ’«

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

the destructor calls unlock() on the mutex that got passed in as a parameter to the constructor. she cleans up after herself. we love a queen who does her own dishes πŸ“


🌈 Member Data Documentation 🌈

⭐ SbThreadMutex* SbThreadAutoLock::recmutex [protected]

heads up bestie: this API member is considered internal to the library, as it is not likely to be of interest to the application programmer. so like… look away πŸ™ˆ

🌟 Author 🌟

Generated automatically by Doxygen for Coin from the source code. no human wrote this one, it manifested itself fr fr 😭


and that's the whole page, bestie!! this was SbThreadAutoLock(3) from the Coin Library Functions Manual, Version 3.1.3 β€” ty for reading, ily, go lock something safely πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from