// odd/even thread coordination on incrementing an global // variable. This version uses a condition variable to efficiently // notify threads of changes to the global variable. #include "odds_evens.h" int count = 0; // global variable all threads are modifiying pthread_mutex_t count_mutex; // mutex to check count pthread_cond_t count_condv; // condition variable to receive wake-ups // Run by even child threads, increment count when it is even void *even_work(void *t) { int tid = *( (int *) t); for(int i=0; i