Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
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
37
38static _RWSTD_THREAD char tls_static_array [256];
39extern _RWSTD_THREAD char tls_extern_array [256];
40
42
43int main ()
44{
45 int result = tls_i + tls_static_array [0] + tls_extern_array [0];
46
47 if (0 == result)
49
50 return result;
51}
volatile int result
_RWSTD_THREAD int tls_i
Definition TLS.cpp:36
_RWSTD_THREAD char tls_extern_array[256]
Definition TLS.cpp:41
#define _RWSTD_THREAD
Definition TLS.cpp:30
#define PRINT_MACRO(name)
Definition TLS.cpp:34
int main()
Definition TLS.cpp:43