ost::MutexCounter(3)
π NAME π
okay so you opened ost::MutexCounter(3) β section 3 of the manual, the library functions zone, iykyk β and bestie, this one is a whole vibe. She's the Mutex Counter: a counter variable that multiple threads can increment or decrement safely. No race conditions, no chaos, just a locked-down little integer living her best life. π
β¨ SYNOPSIS β¨
#include <thread.h>
She inherits ost::Mutex β that's the whole point of her, she's a mutex with a counter glow-up. πΈ
π«Ά Public Member Functions
MutexCounter(const char *id=NULL)β creates a mutex protected counter, and you can give her a name if you want. β¨MutexCounter(int initial, const char *id=NULL)β same thing, but you also get to hand her an initial value to start counting from. π
π Friends
__EXPORT int operator++(MutexCounter &mc)__EXPORT int operator--(MutexCounter &mc)
π¦ Additional Inherited Members
she also carries along the extra inherited members that come with being an ost::Mutex β not me saying she's got main character energy and family connections π
π Detailed Description π
The Mutex Counter is a counter variable which can safely be incremented or decremented by multiple threads. fr fr. π«Ά
A Mutex is used to protect access to the counter variable (an integer). An initial value can be specified for the counter, and it can be manipulated with the ++ and -- operators. That's it, that's the whole thing β simple, iconic, does exactly what it says on the tin. π
lowkey the entire personality here is "protect the integer, protect the peace." π§
βοΈ Author
David Sugar dyfet@ostel.com
Thread protected integer counter.
π Constructor & Destructor Documentation π
π ost::MutexCounter::MutexCounter (const char * id = NULL)
Create and optionally name a mutex protected counter. π
Parameters
idβ name for mutex counter, optional for deadlock testing.
π ost::MutexCounter::MutexCounter (int initial, const char * id = NULL)
Create and optionally name a mutex protected counter with an initial value. β¨
Parameters
initialβ value of counter.idβ name of counter, optional for deadlock testing.
π₯ Friends And Related Function Documentation π₯
π« __EXPORT int operator++ (MutexCounter & mc) [friend]
π« __EXPORT int operator-- (MutexCounter & mc) [friend]
π Author π
Generated automatically by Doxygen for GNU CommonC++ from the source code. she wasn't hand-written, she was generated, and honestly? still ate. πβ¨
okay that's the whole page bestie, we made it to the end π this absolute icon of a manpage is brought to you by GNU CommonC++, stamped Sun Dec 27 2020, and filed forever under ost::MutexCounter(3). go forth and increment safely, mwah ππΈπ
π¦ where this page comes from
- ubuntu jammy: libcommoncpp2-doc 1.8.1-10
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms