code: protected boolean waitForTasks() {
  		synchronized (this.tasks) {
  			while (!this.closed && !this.hasTaskPending()) {
  				try {
  					this.tasks.wait();
  				} catch (InterruptedException e) {
  					e.printStackTrace();
  				}
  			}
  		}
  
  		return !this.closed;
  	}
docs: Wait until the TaskQueue has a Task ready to process. If the TaskQueue is closed this method will also return
  but giving the value "false".
  @return true if the TaskQueue has a Task ready to process, false if it has been closed