/**
  * Checks the currently queued tasks if there are ones which are no longer blocked by dependencies
  * and executes them.
  */
 private static final void checkQueueForDependenciesAndExecuteUnblockedTasks() {
   // a task has finished, now check tasks in queue if there are ones which are no
   // longer blocked
   List<ProgressThread> toRemove = new LinkedList<>();
   synchronized (LOCK) {
     for (ProgressThread pg : queuedThreads) {
       if (!pg.isBlockedByDependencies()) {
         // busy waiting tasks should not be started here, they will notice themselves
         if (!pg.isWaiting()) {
           toRemove.add(pg);
           EXECUTOR.execute(pg.makeWrapper());
         }
       }
     }
   }
   // remove here to avoid concurrent modifications
   for (ProgressThread pg : toRemove) {
     synchronized (LOCK) {
       queuedThreads.remove(pg);
     }
   }
 }