/usr/include/root/TAtomicCount.h is in libroot-core-dev 5.34.14-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | // @(#)root/thread:$Id$
// Author: Fons Rademakers 14/11/06
/*************************************************************************
* Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TAtomicCount
#define ROOT_TAtomicCount
//////////////////////////////////////////////////////////////////////////
// //
// TAtomicCount //
// //
// Class providing atomic operations on a long. Setting, getting, //
// incrementing and decrementing are atomic, thread safe, operations. //
// //
// TAtomicCount a(n); //
// //
// (n is convertible to long) //
// //
// Effects: Constructs an TAtomicCount with an initial value of n. //
// //
// long(a); //
// //
// Returns: (long) the current value of a. //
// //
// ++a; //
// //
// Effects: Atomically increments the value of a. //
// Returns: nothing. //
// //
// --a; //
// //
// Effects: Atomically decrements the value of a. //
// Returns: (long) zero if the new value of a is zero, //
// unspecified non-zero value otherwise //
// (usually the new value). //
// //
// a.Set(n); //
// //
// Effects: Set a to the value n. //
// Returns: nothing. //
// //
// a.Get(); //
// //
// Returns: (long) the current value of a. //
// //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
#ifndef ROOT_RConfigure
#include "RConfigure.h"
#endif
#if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) && !defined(__CINT__)
#include "TAtomicCountGcc.h"
#elif defined(_WIN32) && !defined(__CINT__)
#include "TAtomicCountWin32.h"
#elif defined(R__HAS_PTHREAD) && !defined(__CINT__)
#include "TAtomicCountPthread.h"
#else
class TAtomicCount {
private:
Long_t fCnt; // counter
TAtomicCount(const TAtomicCount &); // not implemented
TAtomicCount &operator=(const TAtomicCount &); // not implemented
public:
explicit TAtomicCount(Long_t v) : fCnt(v) { }
void operator++() { ++fCnt; }
Long_t operator--() { return --fCnt; }
operator long() const { return fCnt; }
void Set(Long_t v) { fCnt = v; }
Long_t Get() const { return fCnt; }
};
#endif
#endif
|