This file is indexed.

/usr/include/libMUSCLE-3.7/libMUSCLE/threadstorage.h is in libmuscle-3.7-dev 3.7+4565-1.

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
#ifndef _threadstorage_h_
#define _threadstorage_h_

// aed 9/7/7: MUSCLE v3.6 made prolific use of file and function-scope static variables.
// When running multi-threaded, the shared nature of static variables
// results in nasty race conditions.
//
// The TLS template defines thread-local storage for a particular variable
//

#ifdef _OPENMP
#define MAX_THREAD_COUNT	16
#define OMP_GET_THREAD_NUM	omp_get_thread_num()
#include <omp.h>
#else
#define MAX_THREAD_COUNT	1
#define OMP_GET_THREAD_NUM	0

#endif


#define NELEMS(o)	sizeof(o)/sizeof(o[0])

template<typename T>
class TLS
{
public:
	TLS(){};

	TLS( T t_val ){
		for(int i = 0; i < MAX_THREAD_COUNT; i++)
			t[i] = t_val;
	}

	T& get()
	{
		return t[OMP_GET_THREAD_NUM];
	}
private:
	TLS( const TLS& tls );	// disallow copying
	T t[MAX_THREAD_COUNT];
};


/**
 * A thread-local storage class specifically to handle string constant initializers.
 * The above TLS code gives the compiler fits for string constants.
 */
template<typename T>
class TLSstr
{
public:
	TLSstr(){};

	TLSstr( T t_val ){
		for(int i = 0; i < MAX_THREAD_COUNT; i++)
			memcpy(t[i], t_val, sizeof(t_val));
	}

	T& get()
	{
		return t[OMP_GET_THREAD_NUM];
	}
private:
	TLSstr( const TLSstr& tls );	// disallow copying
	T t[MAX_THREAD_COUNT];
};


#endif	// _threadstorage_h_