This file is indexed.

/usr/include/vtk-6.2/vtkAtomicInt.h is in libvtk6-dev 6.2.0+dfsg1-10build1.

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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
 /*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkAtomicInt.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkAtomicInt - Provides support for atomic integers
// .SECTION Description
// Objects of atomic types are C++ objects that are free from data races;
// that is, if one thread writes to an atomic object while another thread
// reads from it, the behavior is well-defined. vtkAtomicInt provides
// a subset of the std::atomic API and implementation, mainly for 32 bit
// and 64 bit signed integers. For these types, vtkAtomicInt defines a
// number of operations that happen atomically - without interruption
// by another thread. Furthermore, these operations happen in a
// sequentially-consistent way and use full memory fences. This means
// that operations relating to atomic variables happen in the specified
// order and the results are made visible to other processing cores to
// guarantee proper sequential operation. Other memory access patterns
// supported by std::atomic are not currently supported.
//
// Note that when atomic operations are not available on a particular
// platform or compiler, mutexes, which are significantly slower, are used
// as a fallback.

#ifndef vtkAtomicInt_h
#define vtkAtomicInt_h

#include "vtkCommonCoreModule.h" // For export macro
#include "vtkSystemIncludes.h"
#include "vtkConfigure.h"

#if defined(__APPLE__)
# include <libkern/OSAtomic.h>
#endif

#if (defined(_WIN32)  && !defined(__MINGW32__))
# define VTK_WINDOWS_ATOMIC
# if defined(_MSC_VER)
#  pragma warning(disable:4324) // disable warning about the padding due to alignment
# endif
#endif

#if defined(VTK_WINDOWS_ATOMIC) || defined(__APPLE__) || defined(VTK_HAVE_SYNC_BUILTINS)
# define VTK_HAS_ATOMIC32
#endif

// Overall, we assume that 64 bit atomic operations are not available on 32
// bit systems.
#if VTK_SIZEOF_VOID_P == 8
# if defined(VTK_WINDOWS_ATOMIC) || defined(__APPLE__) || defined(VTK_HAVE_SYNC_BUILTINS)
#  define VTK_HAS_ATOMIC64
# endif
#endif

#if !defined(VTK_HAS_ATOMIC64) || !defined(VTK_HAS_ATOMIC32)
class vtkSimpleCriticalSection;
#endif

// Below are the actual implementations of 32 and 64 bit atomic operations.
namespace detail
{
#if defined (VTK_WINDOWS_ATOMIC)
# define VTK__ALIGN32 __declspec(align(32))
#else
# define VTK__ALIGN32
#endif

template <typename T> class vtkAtomicIntImpl;

template <>
#if defined(VTK_HAS_ATOMIC32) && !defined(VTK_WINDOWS_ATOMIC)
class vtkAtomicIntImpl<vtkTypeInt32>
#else
class VTKCOMMONCORE_EXPORT vtkAtomicIntImpl<vtkTypeInt32>
#endif
{
public:

  // Description:
  // Atomic pre-increment.
#if defined(VTK_HAS_ATOMIC32) && !defined(VTK_WINDOWS_ATOMIC)
  vtkTypeInt32 operator++()
    {
# if defined(__APPLE__)
    return OSAtomicIncrement32Barrier(&this->Value);

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
    return __sync_add_and_fetch(&this->Value, 1);

# endif
    }

  // Description:
  // Atomic pre-decrement.
  vtkTypeInt32 operator--()
    {
# if defined(__APPLE__)
    return OSAtomicDecrement32Barrier(&this->Value);

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
    return __sync_sub_and_fetch(&this->Value, 1);

# endif
    }

  // Description:
  // Atomic add. Returns value after addition.
  vtkTypeInt32 operator+=(vtkTypeInt32 val)
    {
# if defined(__APPLE__)
    return OSAtomicAdd32Barrier(val, &this->Value);

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
    return __sync_add_and_fetch(&this->Value, val);

# endif
    }

  // Description:
  // Atomic fetch.
  vtkTypeInt32 load() const
    {
# if defined(__APPLE__)
    vtkTypeInt32 retval = 0;
    OSAtomicCompareAndSwap32Barrier(retval, this->Value, &retval);
    return retval;

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
    vtkTypeInt32 retval = 0;
    __sync_val_compare_and_swap(&retval, retval, this->Value);
    return retval;

# endif
    }

  // Description:
  // Atomic save.
  void store(vtkTypeInt32 val)
    {
# if defined(__APPLE__)
    OSAtomicCompareAndSwap32Barrier(this->Value, val, &this->Value);

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
  __sync_val_compare_and_swap(&this->Value, this->Value, val);

#endif
    }

#else // defined(VTK_HAS_ATOMIC32) && !defined(VTK_WINDOWS_ATOMIC)

  // These methods are for when using a mutex. Same as above.
  // A virtual descructor is used becase the mutex is constructed
  // with new to avoid including windows header in the .h file.
  vtkAtomicIntImpl<vtkTypeInt32>();
  virtual ~vtkAtomicIntImpl<vtkTypeInt32>();
  vtkTypeInt32 operator++();
  vtkTypeInt32 operator--();
  vtkTypeInt32 operator+=(vtkTypeInt32 val);
  vtkTypeInt32 load() const;
  void store(vtkTypeInt32 val);

#endif // defined(VTK_HAS_ATOMIC32) && !defined(VTK_WINDOWS_ATOMIC)

protected:
  // Explicitely aligning Value on Windows is probably not necessary
  // since the compiler should automatically do it. Just being extra
  // cautious since the InterlockedXXX() functions require alignment.
  VTK__ALIGN32 vtkTypeInt32 Value;

#if !defined(VTK_HAS_ATOMIC32)
  vtkSimpleCriticalSection* AtomicInt32CritSec;
#endif
};

#if defined (VTK_WINDOWS_ATOMIC)
# define VTK__ALIGN64 __declspec(align(64))
#else
# define VTK__ALIGN64
#endif

template <>
#if defined(VTK_HAS_ATOMIC64) && !defined(VTK_WINDOWS_ATOMIC)
class vtkAtomicIntImpl<vtkTypeInt64>
#else
class VTKCOMMONCORE_EXPORT vtkAtomicIntImpl<vtkTypeInt64>
#endif
{
public:

  // Description:
  // Atomic pre-increment.
#if defined(VTK_HAS_ATOMIC64) && !defined(VTK_WINDOWS_ATOMIC)
  vtkTypeInt64 operator++()
    {
# if defined(__APPLE__)
    return OSAtomicIncrement64Barrier(&this->Value);

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
    return __sync_add_and_fetch(&this->Value, 1);

# endif
   }

  // Description:
  // Atomic pre-decrement.
  vtkTypeInt64 operator--()
    {
# if defined(__APPLE__)
    return OSAtomicDecrement64Barrier(&this->Value);

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
    return __sync_sub_and_fetch(&this->Value, 1);

# endif
    }

  // Description:
  // Atomic add. Returns value after addition.
  vtkTypeInt64 operator+=(vtkTypeInt64 val)
    {
# if defined(__APPLE__)
    return OSAtomicAdd64Barrier(val, &this->Value);

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
    return __sync_add_and_fetch(&this->Value, val);

# endif
    }

  // Description:
  // Atomic fetch.
  vtkTypeInt64 load() const
    {
# if defined(__APPLE__)
  vtkTypeInt64 retval = 0;
  OSAtomicCompareAndSwap64Barrier(retval, this->Value, &retval);
  return retval;

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
  vtkTypeInt64 retval = 0;
  __sync_val_compare_and_swap(&retval, retval, this->Value);
  return retval;

# endif
    }

  // Description:
  // Atomic store.
  void store(vtkTypeInt64 val)
    {
# if defined(__APPLE__)
  OSAtomicCompareAndSwap64Barrier(this->Value, val, &this->Value);

// GCC, CLANG, etc
# elif defined(VTK_HAVE_SYNC_BUILTINS)
  __sync_val_compare_and_swap(&this->Value, this->Value, val);

# endif
    }

#else // defined(VTK_HAS_ATOMIC64) && !defined(VTK_WINDOWS_ATOMIC)

  // These methods are for when using a mutex. Same as above.
  // A virtual descructor is used becase the mutex is constructed
  // with new to avoid including windows header in the .h file.
  vtkAtomicIntImpl<vtkTypeInt64>();
  virtual ~vtkAtomicIntImpl<vtkTypeInt64>();
  vtkTypeInt64 operator++();
  vtkTypeInt64 operator--();
  vtkTypeInt64 operator+=(vtkTypeInt64 val);
  vtkTypeInt64 load() const;
  void store(vtkTypeInt64 val);

#endif // defined(VTK_HAS_ATOMIC64) && !defined(VTK_WINDOWS_ATOMIC)

protected:
 // Explicitely aligning Value on Windows is probably not necessary
  // since the compiler should automatically do it. Just being extra
  // cautious since the InterlockedXXX() functions require alignment.
  VTK__ALIGN64 vtkTypeInt64 Value;

#if !defined(VTK_HAS_ATOMIC64)
  vtkSimpleCriticalSection* AtomicInt64CritSec;
#endif
};
}

template <typename T>
class vtkAtomicInt: public detail::vtkAtomicIntImpl<T>
{
  typedef detail::vtkAtomicIntImpl<T> Superclass;

public:
  // Description:
  // Default constructor. Not atomic.
  vtkAtomicInt()
    {
    this->Value = 0;
    }

  // Description:
  // Constructor with initialization. Not atomic.
  vtkAtomicInt(T val)
    {
    this->Value = val;
    }

  // Description:
  // Atomic pre-increment.
  T operator++()
    {
    return this->Superclass::operator++();
    }

  // Description:
  // Atomic post-increment.
  T operator++(int)
    {
    return this->operator++() - 1;
    }

  // Description:
  // Atomic pre-decrement.
  T operator--()
    {
    return this->Superclass::operator--();
    }

  // Description:
  // Atomic post-decrement.
  T operator--(int)
    {
    return this->operator--() + 1;
    }

  // Description:
  // Atomic subtraction. Returns value after.
  T operator-=(T val)
    {
    return this->operator+=(-val);
    }

  // Description:
  // Atomic load.
  operator T() const
    {
    return this->load();
    }

  // Description:
  // Atomic save.
  T operator=(T val)
    {
    this->store(val);
    return val;
    }
};


#endif
// VTK-HeaderTest-Exclude: vtkAtomicInt.h