public void Start(int workerCount, string destinationFolder, FileProductionRules fileProductionRules, OperationsWorkflow workflow, string apiKey) { lock (_locker) { _cancellationPending = false; } InitializeApiInstances(out PDFApi pdfApiInstance, out ImageApi imageApiInstance, apiKey); destinationFolder = ParsingUtils.EnsureFolderPathEndsWithBackSlash(destinationFolder); bool fileSizeReductionIsIntended = OperationsWorkflowUtilities.IsFileSizeReductionIntended(workflow); for (int i = 1; i <= workerCount; i++) { int workerNumber = i; // Launch the workers. Thread thread = new Thread(() => Process(pdfApiInstance, imageApiInstance, workerNumber, fileProductionRules, workflow, destinationFolder, fileSizeReductionIsIntended)); thread.Start(); _busyWorkersCount++; } }