SbStorage(3)

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

πŸ’– SbStorage πŸ’–

okay bestie, so this is a page from the Library Functions Manual β€” the SbStorage(3) one β€” and it's literally all about thread-local memory. she's giving "quiet static data, but make it per-thread" energy. let's get into it 🫢


✨ NAME ✨

SbStorage β€” the SbStorage class manages thread-local memory. periodt.


🌸 SYNOPSIS 🌸

#include <Inventor/threads/SbStorage.h>

πŸŽ€ Public Member Functions

SbStorage (unsigned int size)
SbStorage (unsigned int size, void(*constr)(void *), void(*destr)(void *))
~SbStorage (void)
void * get (void)
void applyToAll (SbStorageApplyFunc *func, void *closure)

πŸ¦‹ Detailed Description πŸ¦‹

The SbStorage class manages thread-local memory.

This class manages thread-local memory. When different threads access the memory an SbStorage object manages, they will receive different memory blocks back. no cap, each thread gets its own lil stash πŸ“

This provides a mechanism for sharing read/write static data. iconic behaviour tbh.

One important implementation detail: if the Coin library was explicitly configured to be built without multi-platform thread abstractions, or neither pthreads nor native Win32 thread functions are available, it will be assumed that the client code will all run in the same thread. Which means πŸ‘€ the same memory block will be returned for any request without considering the current thread id. so like… everyone's sharing the same brain cell in that case, lowkey πŸ’€


πŸ’… Constructor & Destructor Documentation πŸ’…

🌈 SbStorage::SbStorage (unsigned int size) [inline]

Constructor. size specifies the number of bytes each thread should have in this thread-local memory management object. that's your per-thread allowance, bestie, spend it wisely ✨

🌈 SbStorage::SbStorage (unsigned int size, void(* constr )(void *), void(* destr )(void *)) [inline]

Constructor. size specifies the number of bytes each thread should have in this thread-local memory management object. A constructor and a destructor functions can be given that will be called when the actual memory blocks are allocated and freed. so like, constr runs on the glow-up moment (allocation) and destr runs on the goodbye moment (freeing) πŸ₯Ή

🌈 SbStorage::~SbStorage (void ) [inline]

The destructor. she's leaving, but gracefully πŸ’…


πŸ‘‘ Member Function Documentation πŸ‘‘

⭐ void * SbStorage::get (void ) [inline]

This method returns the calling thread's thread-local memory block. your block, specifically β€” not your neighbour's. main character energy fr fr.

⭐ void SbStorage::applyToAll (SbStorageApplyFunc * func, void * closure) [inline]

This method will call func for all thread local storage data. closure will be supplied as the second parameter to the callback. so it's a little group-chat roll call for every thread's storage πŸ“£βœ¨


🧚 Author 🧚

Generated automatically by Doxygen for Coin from the source code. (not a human, just vibes and tooling 🫢)


heads up bestie: those [inline] tags and the exact signatures are doing real work β€” don't be out here renaming func or closure, okay? iykyk 🌸

and that's the whole page, queen πŸ‘‘ it came from Coin, Version 2.5.0, dated as SbStorage(3) β€” so go forth and keep your threads' memories cute and separate πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from