fix condvar timedwait func; no static mutex

use pthread_mutex_t and PTHREAD_MUTEX_INITIALIZER instead