4 __thread int tls_fix = 23;
7 static void *f(void *arg)
10 error("fixed init failed: want 23 got %d\n", tls_fix);
12 error("zero init failed: want 0 got %d\n", tls_zero);
18 #define CHECK(f) do{ if(f) error("%s failed.\n", #f); }while(0)
19 #define length(a) (sizeof(a)/sizeof*(a))
27 error("fixed init failed: want 23 got %d\n", tls_fix);
29 error("zero init failed: want 0 got %d\n", tls_zero);
31 for (j = 0; j < 2; j++) {
32 for (i = 0; i < length(t); i++) {
33 CHECK(pthread_create(t+i, 0, f, 0));
37 for (i = 0; i < length(t); i++)
38 CHECK(pthread_join(t[i], 0));