anchor.diff:      strict private
         FRunners : TTaskRunnerList;
       public
  +      constructor Create(const Executable : TFileName; Options : TFixInsightOptions;
  +        const Files : TArray<TFileName>; const TempDirectory : String);
         destructor Destroy; override;
  +
  +      function RunAndReturn : IFuture<TArray<TFileName>>;
     end;
   
   implementation
  
positive.code: 
  { TTaskManager }
  
  destructor TTaskManager.Destroy;
  begin
    FreeAndNil(FRunners);
  
negative.code:   inherited Destroy;
  end;
  
  function TTaskManager.RunAndReturn : IFuture<TArray<TFileName>>;
  var
    R : TTaskRunner;
    arrTasks : TArray<ITask>;
  begin
    for R in FRunners do
      arrTasks := arrTasks + [R.Execute];
  
    Result := TTask.Future<TArray<TFileName>>(
      function : TArray<TFileName>
      var
        TR : TTaskRunner;
      begin
        //TODO: no exception handling - IFuture is a bad idea
        TTask.WaitForAll(arrTasks);
  
        //TODO: multi-threaded access to thread-unsafe classes
        for TR in FRunners do
          Result := Result + [TR.OutputFileName];
      end
    );
  end;
  
  end.
  