The previous code relied on the assumption that pthread_cond_init(&cond)