Find queue *inside* the loop in case the queue has been deleted by the
user at runtime.  Also add logging for conditions which would
terminate the thread.