Uses pthread_cond_signal rather than pthread_cond_broadcast to avoid thundering herd problem.