Added timeout to condition wait for queue to have some content.