changed pthread_cond_timed_wait() to proper prototype