I am really confused. I run the following code to execute two task, which work on separate folders, thats why I give them index. Unfortunately, when I run the code below, index passed to ProcessingTask static method is always 2...
        tasks = new Task[sets.ThreadCount];
        for (int i = 0; i < sets.ThreadCount; i++)
        {
            tasks[i] = Task.Factory.StartNew
                (
                 () =>
                 {
                     ProcessingTask.run(
                                         i,
                                         stack,
                                         collector,
                                         sets,
                                         cts.Token,
                                         LOG
                                        );
                 },
                 cts.Token,
                 TaskCreationOptions.LongRunning,
                 TaskScheduler.Default
                );
        }
Any ideas?
 
    