title: Communication between Two threads in pthread
body: <p>I am creating two threads thread1 and thread2. Thread1 is reading the Analog value and thread2 shall process the analog value which is read in thread1 and sets the PWM arguments. what I have done till now is, in main file ( where I am creating threads) I have declared a global variable ( to store the analog value) and passing the pointer to the global variable to both the threads. In thread1 the the read analog value storing in the global variable and in thread2 reads the global variable and processing it. So, my question is is there any another way to do this ? i.e. we have semaphore, mutex etc which is best suitable for this application?   </p>