| 1 |
#include <stdio.h> |
| 2 |
|
| 3 |
#if defined EXTERN_TLS |
| 4 |
__thread unsigned long tls1 = 1; |
| 5 |
__thread unsigned long tls2 = 2; |
| 6 |
#else |
| 7 |
static __thread unsigned long tls1 = 1; |
| 8 |
static __thread unsigned long tls2 = 2; |
| 9 |
#endif |
| 10 |
|
| 11 |
void* increase_tls_worker (); |
| 12 |
|
| 13 |
|
| 14 |
void* |
| 15 |
increase_tls (void *arg) |
| 16 |
{ |
| 17 |
tls1 = tls1 + (unsigned long)(*((char*)arg) - '0'); |
| 18 |
tls2 = tls2 + (unsigned long)(*((char*)arg) - '0'); |
| 19 |
#if defined EXTERN_TLS |
| 20 |
increase_tls_worker(); |
| 21 |
#endif |
| 22 |
stp_probe: |
| 23 |
printf ("tls counter for %c: %d/%d\n", (char)*((char*)arg), tls1, tls2); |
| 24 |
} |