A thread-safe stack of N indexes (0 to size - 1).
RSlotStack can be used to safely assign a "processing slot" number to each thread in multi-thread applications. In release builds, pop and push operations are unchecked, potentially resulting in undefined behavior if more slot numbers than available are requested. An important design assumption is that a slot will almost always be available when a thread asks for it, and if it is not available it will be very soon, therefore a spinlock is used for synchronization.
Definition at line 30 of file RSlotStack.hxx.
Public Member Functions | |
RSlotStack ()=delete | |
RSlotStack (unsigned int size) | |
unsigned int | GetSlot () |
void | ReturnSlot (unsigned int slotNumber) |
Private Attributes | |
ROOT::TSpinMutex | fMutex |
const unsigned int | fSize |
std::stack< unsigned int > | fStack |
#include <ROOT/RSlotStack.hxx>
|
delete |
ROOT::Internal::RSlotStack::RSlotStack | ( | unsigned int | size | ) |
Definition at line 17 of file RSlotStack.cxx.
unsigned int ROOT::Internal::RSlotStack::GetSlot | ( | ) |
Definition at line 31 of file RSlotStack.cxx.
void ROOT::Internal::RSlotStack::ReturnSlot | ( | unsigned int | slotNumber | ) |
Definition at line 23 of file RSlotStack.cxx.
|
private |
Definition at line 34 of file RSlotStack.hxx.
|
private |
Definition at line 32 of file RSlotStack.hxx.
|
private |
Definition at line 33 of file RSlotStack.hxx.