]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/test/tls/tst-tlsmod-at-ctor.c
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / test / tls / tst-tlsmod-at-ctor.c
1 #include <stdio.h>
2 #include <tls.h>
3
4 #define TLS_VAR_INIT_VALUE 99
5
6 #ifdef USE_TLS
7 __thread int tls_var  __attribute__((tls_model("global-dynamic")));
8 static __thread int local_tls_var __attribute__((tls_model("local-dynamic")));
9 #endif
10
11 void __attribute__((constructor)) libtls_ctor(void);
12 void libtls_ctor(void)
13 {
14         printf("libtls: constructor!\n");
15 #ifdef USE_TLS
16         local_tls_var = TLS_VAR_INIT_VALUE;
17         tls_var = local_tls_var;
18 #endif
19 }
20
21 void __attribute__((destructor)) libtls_dtor(void);
22 void libtls_dtor(void)
23 {
24         printf("libtls: destructor!\n");
25 }