added pthread_cond stuff