ROOT
Version master
v6.36
v6.34
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
Reference Guide
▼
ROOT
ROOT Reference Documentation
Tutorials
►
Functional Parts
►
Namespaces
►
All Classes
▼
Files
▼
File List
►
bindings
▼
core
►
base
►
clingutils
►
cont
►
dictgen
►
foundation
►
gui
▼
imt
►
inc
▼
src
base.cxx
►
ROpaqueTaskArena.hxx
RSlotStack.cxx
►
RTaskArena.cxx
TExecutor.cxx
►
TImplicitMT.cxx
►
TTaskGroup.cxx
►
TThreadExecutor.cxx
►
macosx
►
meta
►
metacling
►
multiproc
►
rint
►
testsupport
►
thread
►
unix
►
winnt
►
zip
►
documentation
►
geom
►
graf2d
►
graf3d
►
gui
►
hist
►
io
►
main
►
master
►
math
►
montecarlo
►
net
►
proof
►
roofit
►
sql
►
tmva
►
tree
►
tutorials
►
File Members
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
RSlotStack.cxx
Go to the documentation of this file.
1
// Author: Enrico Guiraud, Danilo Piparo CERN 03/2017
2
3
/*************************************************************************
4
* Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
5
* All rights reserved. *
6
* *
7
* For the licensing terms see $ROOTSYS/LICENSE. *
8
* For the list of contributors see $ROOTSYS/README/CREDITS. *
9
*************************************************************************/
10
11
#include <
ROOT/RSlotStack.hxx
>
12
13
#include <stdexcept>
14
#include <string>
15
16
ROOT::Internal::RSlotStack::RSlotStack
(
unsigned
int
size
) : fSlots(
size
) {}
17
18
void
ROOT::Internal::RSlotStack::ReturnSlot
(
unsigned
int
slot
)
19
{
20
if
(
slot
>= fSlots.size())
21
throw
std::invalid_argument(
"RSlotStack: A slot that is larger than the number of slots was returned :"
+
22
std::to_string(
slot
));
23
bool
expected
=
true
;
24
if
(!fSlots[
slot
].fAtomic.compare_exchange_strong(
expected
,
false
))
25
throw
std::logic_error(
"RSlotStack: A slot that is not assigned was returned: "
+ std::to_string(
slot
));
26
}
27
28
unsigned
int
ROOT::Internal::RSlotStack::GetSlot
()
29
{
30
while
(
true
) {
31
for
(
unsigned
int
i = 0; i < fSlots.size(); ++i) {
32
// test if a slot is available (assigned == false)
33
bool
expectedState
=
false
;
34
if
(fSlots[i].fAtomic.compare_exchange_strong(
expectedState
,
true
)) {
35
return
i;
36
}
37
}
38
}
39
}
RSlotStack.hxx
size
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
ROOT::Internal::RSlotStack::GetSlot
unsigned int GetSlot()
Definition
RSlotStack.cxx:28
ROOT::Internal::RSlotStack::RSlotStack
RSlotStack()=delete
ROOT::Internal::RSlotStack::ReturnSlot
void ReturnSlot(unsigned int slotNumber)
Definition
RSlotStack.cxx:18
core
imt
src
RSlotStack.cxx
ROOT master - Reference Guide Generated on Wed Apr 23 2025 07:57:53 (GVA Time) using Doxygen 1.10.0