Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
etc
config
src
TLS.cpp
Go to the documentation of this file.
1
// checking for thread-local storage
2
3
25
#include <
stdio.h
>
26
27
#if defined (_MSC_VER)
28
# define _RWSTD_THREAD __declspec (thread)
29
#else
30
# define _RWSTD_THREAD __thread
31
#endif
32
33
#define STR(x) #x
34
#define PRINT_MACRO(name) printf ("#define " #name " " STR (name) "\n")
35
36
_RWSTD_THREAD
int
tls_i
;
37
38
static
_RWSTD_THREAD
char
tls_static_array [256];
39
extern
_RWSTD_THREAD
char
tls_extern_array
[256];
40
41
_RWSTD_THREAD
char
tls_extern_array
[256];
42
43
int
main
()
44
{
45
int
result
=
tls_i
+ tls_static_array [0] +
tls_extern_array
[0];
46
47
if
(0 ==
result
)
48
PRINT_MACRO
(
_RWSTD_THREAD
);
49
50
return
result
;
51
}
result
volatile int result
Definition
18.limits.traps.stdcxx-624.cpp:35
tls_i
_RWSTD_THREAD int tls_i
Definition
TLS.cpp:36
tls_extern_array
_RWSTD_THREAD char tls_extern_array[256]
Definition
TLS.cpp:41
_RWSTD_THREAD
#define _RWSTD_THREAD
Definition
TLS.cpp:30
PRINT_MACRO
#define PRINT_MACRO(name)
Definition
TLS.cpp:34
main
int main()
Definition
TLS.cpp:43
stdio.h
Generated by
1.9.8