avutil/thread: Add pthread_cond_timedwait function