/* Written By: Prawar Poudel 13 Feb 2018 This is written to demonstrate the usage of Thread Local Storage Here using identifier __thread , we have made myVal and myArr[] thread local */ #include #include #include #define NUM_THREADS 5 #define ARRSIZE 5 //this value is a global variable, // but we will store it as thread local, meaning while it is still global the value will can be modified such that the modified value is thread specific __thread int myVal; __thread int myArr[ARRSIZE]; void printMyVal(int id) { int i; printf("My value myVal from thread %d is %d\n", id,myVal); printf("My arr value are\n"); for( i=0;i