Consider a bounded buffer with one producer and two consumer…
Consider a bounded buffer with one producer and two consumers using a single condition variable and while loops: void *producer(void *arg) { mutex_lock(&m); while (count == MAX) cond_wait(&cv, &m); buffer_add(item); count++; cond_signal(&cv); mutex_unlock(&m); } void *consumer(void *arg) { mutex_lock(&m); while (count == 0) cond_wait(&cv, &m); item = buffer_get(); count–; cond_signal(&cv); mutex_unlock(&m); } What can go wrong with this code?