1 #include <unistd.h> 2 3 __thread int var_shared = 33; 4 5 int touch_shared()6touch_shared() 7 { 8 return var_shared; 9 } 10 shared_check()11void shared_check() 12 { 13 var_shared *= 2; 14 usleep(1); // shared thread breakpoint 15 } 16
1 #include <unistd.h> 2 3 __thread int var_shared = 33; 4 5 int touch_shared()6touch_shared() 7 { 8 return var_shared; 9 } 10 shared_check()11void shared_check() 12 { 13 var_shared *= 2; 14 usleep(1); // shared thread breakpoint 15 } 16