pthread: use conditional variable to synchronize

pthread_cond_init
pthread_cond_destroy

pthread_cond_wait
pthread_cond_timedwait

pthread_cond_signal
pthread_cond_broadcast