Use the built-in functionality of wait conditions to determine whether
the queue is empty.