title: Multiple threads update global variables periodically while third thread waiting to read
body: <p>I have two threads A,B periodically update two global sensor reading variables, they execute the same routine. and third thread C will make some calculation on those values as soon as they are updated. I set some condition variable that when A &amp; B both updated the global variables, C will read right away. I am worried that thread C missed some sensor reading due to it uses while loop's polling is arranged after the new A,B updates. I am not sure my worries is necessary, because I a newbie to pthread.
  My development environment is a embedded linux board and I am learning pthread currently.
  Is there a better way than setting two conditional variables for each global variables.</p>