C++/ThreadPool: Replace sem_trywait+sleep with sem_timedwait