ROOT
Version v6.32
master
v6.34
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
►
macosx
►
meta
►
metacling
►
multiproc
►
rint
►
testsupport
▼
thread
▼
inc
►
ROOT
PosixThreadInc.h
►
TAtomicCount.h
►
TAtomicCountGcc.h
►
TAtomicCountPthread.h
►
TCondition.h
►
TConditionImp.h
►
TMutex.h
►
TMutexImp.h
►
TPosixCondition.h
►
TPosixMutex.h
►
TPosixThread.h
►
TPosixThreadFactory.h
►
TRWLock.h
►
TSemaphore.h
►
TThread.h
►
TThreadFactory.h
►
TThreadImp.h
►
TThreadPool.h
►
TWin32AtomicCount.h
►
TWin32Condition.h
►
TWin32Mutex.h
►
TWin32Thread.h
►
TWin32ThreadFactory.h
►
src
►
unix
►
winnt
►
zip
►
documentation
►
geom
►
graf2d
►
graf3d
►
gui
►
hist
►
html
►
io
►
main
►
math
►
montecarlo
►
net
►
proof
►
roofit
►
sql
►
tmva
►
tree
►
tutorials
►
v6-32-00-patches
►
File Members
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
TAtomicCountGcc.h
Go to the documentation of this file.
1
// @(#)root/thread:$Id$
2
// Author: Fons Rademakers 14/11/06
3
4
/*************************************************************************
5
* Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
#ifndef ROOT_TAtomicCountGcc
13
#define ROOT_TAtomicCountGcc
14
15
16
//////////////////////////////////////////////////////////////////////////
17
// //
18
// TAtomicCountGcc //
19
// //
20
// Class providing atomic operations on a long. Setting, getting, //
21
// incrementing and decrementing are atomic, thread safe, operations. //
22
// //
23
// This implementation uses GNU libstdc++ v3 atomic primitives, see //
24
// http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html. //
25
// //
26
// ATTENTION: Don't use this file directly, it is included by //
27
// TAtomicCount.h. //
28
// //
29
//////////////////////////////////////////////////////////////////////////
30
31
#ifndef ROOT_TAtomicCount
32
# error This should be #included only by TAtomicCount.h. Please #include TAtomicCount.h.
33
#endif
//ROOT_TAtomicCount
34
35
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2) || \
36
(defined(__APPLE_CC__) && __APPLE_CC__ > 5000 && !defined(MAC_OS_X_VERSION_10_6))
37
#include <bits/atomicity.h>
38
#else
39
#include <ext/atomicity.h>
40
#endif
41
42
#if defined(__GLIBCXX__)
// g++ 3.4+
43
44
using
__gnu_cxx::__atomic_add;
45
using
__gnu_cxx::__exchange_and_add;
46
47
#endif
48
49
class
TAtomicCount
{
50
private
:
51
mutable
_Atomic_word
fCnt
;
// counter
52
53
TAtomicCount
(
const
TAtomicCount
&) =
delete
;
54
TAtomicCount
&
operator=
(
const
TAtomicCount
&) =
delete
;
55
56
public
:
57
explicit
TAtomicCount
(
Long_t
v
) :
fCnt
(
v
) { }
58
void
operator++
() {
__atomic_add
(&
fCnt
, 1); }
59
Long_t
operator--
() {
return
__exchange_and_add
(&
fCnt
, -1) - 1; }
60
operator
long()
const
{
return
__exchange_and_add
(&
fCnt
, 0); }
61
void
Set
(
Long_t
v
) {
62
fCnt
=
v
;
63
#ifdef _GLIBCXX_WRITE_MEM_BARRIER
64
#if !(defined(__INTEL_COMPILER) && defined(__ia64__))
//ICC doesn't support inline asm on IA-64
65
_GLIBCXX_WRITE_MEM_BARRIER
;
66
#endif
67
#endif
68
}
69
Long_t
Get
()
const
{
return
__exchange_and_add
(&
fCnt
, 0); }
70
};
71
72
#endif
Long_t
long Long_t
Definition
RtypesCore.h:54
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
TAtomicCount
Definition
TAtomicCount.h:67
TAtomicCount::Get
Long_t Get() const
Definition
TAtomicCountGcc.h:69
TAtomicCount::operator++
void operator++()
Definition
TAtomicCountGcc.h:58
TAtomicCount::TAtomicCount
TAtomicCount(const TAtomicCount &)=delete
TAtomicCount::fCnt
Long_t fCnt
Definition
TAtomicCount.h:69
TAtomicCount::fCnt
_Atomic_word fCnt
Definition
TAtomicCountGcc.h:51
TAtomicCount::TAtomicCount
TAtomicCount(Long_t v)
Definition
TAtomicCountGcc.h:57
TAtomicCount::operator--
Long_t operator--()
Definition
TAtomicCountGcc.h:59
TAtomicCount::operator=
TAtomicCount & operator=(const TAtomicCount &)=delete
TAtomicCount::Set
void Set(Long_t v)
Definition
TAtomicCountGcc.h:61
v
@ v
Definition
rootcling_impl.cxx:3687
core
thread
inc
TAtomicCountGcc.h
ROOT v6-32 - Reference Guide Generated on Sun Apr 6 2025 05:41:09 (GVA Time) using Doxygen 1.10.0