ost::ThreadKey(3)
π ost::ThreadKey π
okay bestie, gather round, because we're diving into a page from the Library Functions Manual and it's giving thread-safe realness. this is ost::ThreadKey(3) and she's here to hand you a lil pointer that's all yours, per-thread, no sharing, no drama. π¦
πΈ NAME πΈ
ost::ThreadKey β this class lets you create a thread-context-unique 'pointer' that can be set and retrieved, and it can be used to create thread-specific data areas for implementing 'thread safe' library routines. periodt. π
β¨ SYNOPSIS β¨
#include <thread.h>
π Public Member Functions π
ThreadKey ()β create a unique thread-specific container.virtual ~ThreadKey ()β destroy a thread-specific container and any contents reserved.void * getKey (void)β get the value of the pointer for the thread-specific data container.void setKey (void *)β set the value of the pointer for the current thread-specific execution context.
π«Ά Friends π«Ά
class ThreadImpl
π Detailed Description π
This class allows the creation of a thread-context-unique 'pointer' that can be set and retrieved and can be used to create thread-specific data areas for implementing 'thread safe' library routines. like, imagine every thread gets its own lil locker and nobody else has the combo. iconic behavior. π₯
Finally, Common C++ supports a thread-safe AtomicCounter class. This can often be used for reference counting without having to protect the counter with a separate Mutex counter. This lends to lighter-weight code. ngl, less locking = less stress, and we love a lightweight queen. β¨
Author
- David Sugar
dyfet@ostel.com
container for thread-specific data storage. (yes, that's literally what she is. the whole vibe. π)
π§ Constructor & Destructor Documentation π§
π ost::ThreadKey::ThreadKey ()
Create a unique thread-specific container. brand new, just for you, bestie. π
π virtual ost::ThreadKey::~ThreadKey () [virtual]
Destroy a thread-specific container and any contents reserved. she's leaving, and she's taking her stuff with her. π
π Member Function Documentation π
π void* ost::ThreadKey::getKey (void)
Get the value of the pointer for the thread-specific data container. A unique pointer can be set for each execution context. iykyk β your thread, your pointer, nobody else's. π
Returns
- a unique
void *for each execution context. (yes, unique, fr fr. π )
π void ost::ThreadKey::setKey (void *)
Set the value of the pointer for the current thread-specific execution context. This can be used to store thread-context-specific data. drop your stuff in here, it's safe. π«Ά
Parameters
- ptr to thread-context-specific data.
πΈ Friends And Related Function Documentation πΈ
β friend class ThreadImpl [friend]
π¦ Author π¦
Generated automatically by Doxygen for GNU CommonC++ from the source code.
ok that's the whole page, bestie, no cap. every option, every signature, every return value β all accounted for. π₯°
and a lil sign-off for the girliesss: this lil slice of the GNU CommonC++ manual is dated Sun Dec 27 2020, and the page is ost::ThreadKey(3). mwah, bye. ππβ¨
π¦ 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