This file is indexed.

/usr/include/opencascade/Standard_Atomic.hxx is in libopencascade-foundation-dev 6.5.0.dfsg-2build1.

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
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// File:    Standard_Atomic.hxx
// Created: Tue Sep 04 08:52:43 2007
// Author:  Andrey BETENEV

//! @file 
//! Implementation of some atomic operations (elementary operations 
//! with data that cannot be interrupted by parallel threads in the
//! multithread process) on various platforms
//!
//! By the moment, only operations necessary for reference counter 
//! in Standard_Transient objects are implemented.
//! 
//! Currently only two x86-based configurations (Windows NT with 
//! MS VC++ compiler and Linix with GCC) are really supported.
//! Other configurations use non-atomic C equivalent.

//! @fn     void Standard_Atomic_Increment (int volatile* var)
//! @brief  Increments atomically integer variable pointed by var

//! @fn     int Standard_Atomic_DecrementTest (int volatile* var)
//! @brief  Decrements atomically integer variable pointed by var;
//!         returns 1 if result is zero, 0 otherwise

//===================================================
// Windows NT, MSVC++ compiler
//===================================================
#if defined(WNT)

extern "C" {
long _InterlockedIncrement(long volatile* lpAddend);
long _InterlockedDecrement(long volatile* lpAddend);
}

#pragma intrinsic (_InterlockedIncrement)
#pragma intrinsic (_InterlockedDecrement)

inline void Standard_Atomic_Increment (int volatile* var)
{
  _InterlockedIncrement (reinterpret_cast<long volatile*>(var));
}

inline int Standard_Atomic_DecrementTest (int volatile* var)
{
  return _InterlockedDecrement (reinterpret_cast<long volatile*>(var)) == 0;
}

//===================================================
// GCC compiler on x86 or x86_64
// Note: Linux kernel 2.6x provides definitions for atomic operators
//       in the header file /usr/include/asm/atomic.h,
//       however these definitions involve specific type atomic_t
// Note: The same code probably would work for Intel compiler
//===================================================
#elif defined(__GNUG__) && (defined(__i386) || defined(__x86_64))

inline void Standard_Atomic_Increment (int volatile* var)
{
  // C equivalent:
  // ++(*var);

  __asm__ __volatile__
  (
    "lock incl %0"
  : "=m"(*var) // out
  : "m" (*var) // in 
  );
}

inline int Standard_Atomic_DecrementTest (int volatile* var)
{
  // C equivalent:
  // return --(*var) == 0;

  unsigned char c;
  __asm__ __volatile__
  (
    "lock decl %0; sete %1"
  : "=m"(*var), "=qm"(c) // out
  : "m" (*var)           // in
  : "memory"
  );
  return c != 0;
}

//===================================================
// GCC extension for atomic operations
// http://gcc.gnu.org/wiki/Atomic
//===================================================
#elif defined(__GNUG__) && !defined(__sparc_v9) && !defined(__sparc_v9__) // _Atomic_word is not an int on SPARC V9

#include <ext/atomicity.h>

inline void Standard_Atomic_Increment (int* var)
{
  // C equivalent:
  // ++(*var);

  __gnu_cxx::__atomic_add_dispatch(static_cast<_Atomic_word*>(var), 1);
}

inline int Standard_Atomic_DecrementTest (int* var)
{
  // C equivalent:
  // return --(*var) == 0;

  return __gnu_cxx::__exchange_and_add_dispatch(static_cast<_Atomic_word*>(var),-1) == 1;
}

//===================================================
// Default stub implementation, not atomic actually
//===================================================
#else

inline void Standard_Atomic_Increment (int volatile* var)
{
  ++(*var);
}

inline int Standard_Atomic_DecrementTest (int volatile* var)
{
  return --(*var) == 0;
}

#endif