SbCondVar(3)

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

πŸ’… SbCondVar β€” bestie's guide to not letting your global variables get jumped

ok so like. welcome to the Coin library functions manual, page SbCondVar(3). yes the (3) means it's a library function, we love a category. sit down, grab a strawberry πŸ“, we're gonna talk about threads not stepping on each other.


✨ NAME ✨

SbCondVar β€” a whole class whose entire job is synchronizing access to global variables. it's giving bodyguard energy honestly 🫢


🌸 SYNOPSIS 🌸

first things first, you gotta pull it in:

#include <Inventor/threads/SbCondVar.h>

πŸŽ€ Public Member Functions πŸŽ€

here's the whole roster, no gatekeeping:

SbCondVar (void)
~SbCondVar (void)
SbBool wait (SbMutex &mutex)
SbBool timedWait (SbMutex &mutex, SbTime period)
void wakeOne (void)
void wakeAll (void)

πŸ¦‹ Detailed Description πŸ¦‹

A class for synchronizing access to global variables. periodt.

Condition variables are used to protect global variables in an environment where multiple threads are running concurrently. think of it like a group chat where only one person gets to type at a time and everyone else is on read until they're @'d. iconic behavior, no cap. πŸ’–


🌈 Constructor & Destructor Documentation 🌈

SbCondVar::SbCondVar (void ) β€” [inline]

Constructor. it makes the thing. that's it, that's the vibe. ✨

SbCondVar::~SbCondVar (void ) β€” [inline]

Destructor. it unmakes the thing. bye bestie πŸ‘‹πŸ’œ


πŸ”₯ Member Function Documentation πŸ”₯

SbBool SbCondVar::wait (SbMutex & mutex) β€” [inline]

ok so this one blocks the calling thread β€” like, fully pauses it β€” until another thread calls wakeOne() or wakeAll() on the SbCondVar object. your thread is just sitting there, waiting for the text back. 😭

SbBool SbCondVar::timedWait (SbMutex & mutex, SbTime period) β€” [inline]

same energy as wait(), it blocks the calling thread until another thread calls wakeOne() or wakeAll() on the object β€” BUT. if that doesn't happen within period, the thread gets woken again anyways. the alarm goes off whether you're ready or not, sorry babe. ⏰

here's the tea on the return value:

  • TRUE is returned when the thread wakes because either wakeOne() or wakeAll() was called. slay.
  • FALSE is returned if the wait times out. it's giving ghosted. πŸ’€
References SbTime::getValue(). yes, it actually reaches into SbTime for this, we see you getValue(). πŸ‘‘

void SbCondVar::wakeOne (void ) β€” [inline]

This method wakes up one of the threads waiting on this SbCondVar. just one. not everybody. pick a favorite, i guess. πŸ™ˆ

void SbCondVar::wakeAll (void ) β€” [inline]

This method wakes up all the threads waiting on this SbCondVar. everyone's up, everybody's invited, it's a party now. πŸŽ‰πŸŒˆ


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for Coin from the source code. so like, not a human, but honestly it ate. πŸ’…


ok that's the whole page bestie, go forth and synchronize responsibly 🫢✨

this was Coin, Version 2.5.0, and yeah β€” that's the whole SbCondVar(3) moment. mwah. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from