Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Internal::RSlotStack Class Reference

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 intfStack
 

#include <ROOT/RSlotStack.hxx>

Constructor & Destructor Documentation

◆ RSlotStack() [1/2]

ROOT::Internal::RSlotStack::RSlotStack ( )
delete

◆ RSlotStack() [2/2]

ROOT::Internal::RSlotStack::RSlotStack ( unsigned int  size)

Definition at line 17 of file RSlotStack.cxx.

Member Function Documentation

◆ GetSlot()

unsigned int ROOT::Internal::RSlotStack::GetSlot ( )

Definition at line 31 of file RSlotStack.cxx.

◆ ReturnSlot()

void ROOT::Internal::RSlotStack::ReturnSlot ( unsigned int  slotNumber)

Definition at line 23 of file RSlotStack.cxx.

Member Data Documentation

◆ fMutex

ROOT::TSpinMutex ROOT::Internal::RSlotStack::fMutex
private

Definition at line 34 of file RSlotStack.hxx.

◆ fSize

const unsigned int ROOT::Internal::RSlotStack::fSize
private

Definition at line 32 of file RSlotStack.hxx.

◆ fStack

std::stack<unsigned int> ROOT::Internal::RSlotStack::fStack
private

Definition at line 33 of file RSlotStack.hxx.

Libraries for ROOT::Internal::RSlotStack:

The documentation for this class was generated from the following files: