Parallel and high-performance computing

A thread waits on a condition variable until a shared queue is nonempty. What is the robust way for it to use the condition variable?